The following example uses the UNION clause to query on data in two tables. The compound query performs a union on the stock_num and manu_code columns in the stock and items tables. The statement selects items that have a unit price of less than $25.00 or that have been ordered in quantities greater than three, and it lists their stock_num and manu_code.
SELECT DISTINCT stock_num, manu_code FROM stock WHERE unit_price < 25.00 UNION SELECT stock_num, manu_code FROM items WHERE quantity > 3;Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]