Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have to write a sql query for fetching distinct locations.

I have 3 tables, namely- tblA, tblB, and tblC

All tables contain a column for storing 'location' but with different names.
Now i want to select distinct location from these tables is there any way to do this.

tblA contain 'ALocation' Column for storing location;
tblB contain 'BLocation' Column for storing location;
tblC contain 'CLocation' Column for storing location;
Posted
Updated 10-Nov-12 0:55am
v2

1 solution

Try:

SQL
SELECT  ALocation  from tblA
UNION
SELECT  BLocation  from tblb
UNION
SELECT  CLocation  from tblC
 
Share this answer
 
Comments
pryashrma 10-Nov-12 7:55am    
Thanks for the help
Shanalal Kasim 10-Nov-12 8:56am    
Welcome
Shanalal Kasim 10-Nov-12 9:28am    
please give rating(vote)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900