SQLTutorials  
Powered By PhICK1.com 

SQL UNION

SQL UNION is to join the results of two queries.
UNION only corresponding columns need to be same data type and when using SQL UNION, only distinct values are selected (is similar to SELECT DISTINCT SQL Statement).


Syntax - UNION
(SQL Statement 1)
UNION
(SQL Statement 2)

Below is example for SQL UNION

 

Company

Sales($)

Website

Sql Traniner 2500 http://www.sqltutorials.blogspot.com
BeautyCentury 3000 http://beautycentury.blogspot.com
TravelYourself 2800 http://travelyourself.blogspot.com
Table1

 
Sales

Website

2900 http://www.sqltutorials.blogspot.com
3000 http://beautycentury.blogspot.com
2800 http://travelyourself.blogspot.com
Table2

SQL UNION Statement
SELECT Sales FROM TABLE1
UNION
SELECT Sales FROM TABLE2

Result
 
Sales
2500
2800
2900
3000


powered by www.pHick1.com
SQLTutorials
Sql Server Related Links