1SELECT supplier_id, supplier_name
2FROM suppliers
3WHERE supplier_id <= 500
4UNION
5SELECT company_id, company_name
6FROM companies
7WHERE company_name = 'Apple'
8ORDER BY 2;
1Combines the results from 2 or more SELECT statements and returns only
2distinct values.
3Example: Returns the cities from the events and subscribers tables.
4SELECT city FROM events
5UNION
6SELECT city from subscribers;
1
2 SELECT City FROM Customers
3UNION ALL
4SELECT City FROM Suppliers
5
6 ORDER BY City;
7
1SELECT a.* FROM ((SELECT id FROM mes_report_flow_card) UNION ALL (SELECT id FROM mes_report_part_work_order )) AS alimit 0,10;