English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The UNION command combines the result sets of two or more SELECT statements (only different values)
The following SQL statement retrieves cities from the 'Customers' and 'Suppliers' tables (only different values):
SELECT City FROM Customers UNION SELECT City FROM Suppliers ORDER BY City;
The UNION ALL command combines the result sets of two or more SELECT statements (allows duplicate values).
The following SQL statement retrieves cities from the 'Customers' and 'Suppliers' tables (also with duplicate values):
SELECT City FROM Customers UNION ALL SELECT City FROM Suppliers ORDER BY City;