Tech Junkie Blog - Real World Tutorials, Happy Coding!: SQL: UNION Operator

Monday, February 16, 2015

SQL: UNION Operator

The UNION operator combines two or more SELECT statements into one result set. The SELECT list must be the same in all queries, same columns, expressions, functions, and data types. All UNION queries can be replaced with a join query. The query below combines the Customers select statement with with the Employees statement

SELECT City,Address
FROM Customers
UNION
SELECT City,Address
FROM Employees



Here is the result:






No comments:

Post a Comment

Search This Blog