mysql union
snippet in sql

mysql union

user7991

SELECT supplier_id, supplier_name
FROM suppliers
WHERE supplier_id <= 500
UNION
SELECT company_id, company_name
FROM companies
WHERE company_name = 'Apple'
ORDER BY 2;

sql union

user4438

Combines the results from 2 or more SELECT statements and returns only
distinct values.
Example: Returns the cities from the events and subscribers tables.
SELECT city FROM events
UNION
SELECT city from subscribers;