SQL UNION ALL is combine the results of two
queries together without filter out the same value(no distinct behavior).

The difference between UNION ALL and
UNION is UNION
only selects distinct values and UNION ALL selects all
values.


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


Below is example for SQL
UNION




















Company

Sales($)

Website

Sql Traniner2500http://www.sqltutorials.blogspot.com
BeautyCentury3000http://beautycentury.blogspot.com
TravelYourself2800http://travelyourself.blogspot.com
Table1














Sales

Website

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

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

Result
















Sales
2500
3000
2800
2900
3000
2800
posted on 2011-06-28 14:14  higirle  阅读(216)  评论(0编辑  收藏  举报