Saturday, June 9, 2007

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 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 Statement
SELECT Sales FROM TABLE1
UNION
SELECT Sales FROM TABLE2

Result
Sales
2500
2800
2900
3000

4 comments:

Ashley said...

WoW nice blog buddy!Actually WoW is my favorite appreciation keyword. I also like to play. Wow Gold. I was looking for info regarding that and saw your website. Its nice and very interesting.

Mind said...

wow news

Good one

Mind said...

wow gold kaufen


Good post

GuildWars2Items said...

buy c9 gold you laugh at me for being different, but I laugh at you for being the same, the past is gone and static. Nothing we can do will change it. The future is before us and dynamic. Everything we do will affect it cheap c9 gold, don't go around saying the world owes you a living. The world owes you nothing. It was here first c9 money.

The past is gone and static. Nothing we can do will change it.scarlet blade gold, the future is before us and dynamic. Everything we do will affect it rs gold, You laugh at mescarlet blade gold for being different , but I laugh at you for being the same.