Click here to Skip to main content
15,910,981 members
Please Sign up or sign in to vote.
1.11/5 (3 votes)
See more:
i have 3 tables named as registration , lkg and ukg now i want total data from these tables.
i used the following query
select * from registration,lkg,ukg.
it displays out put but all those data displayed in 3 times
how can i retrieve this data
...........
thank you
Posted

Use Inner Join To Reduce Your Problem
 
Share this answer
 
See this recent answer and follow the link mentioned there : How to get data from two tables[^]
 
Share this answer
 
The syntax you are using here is called 'implicit cross join' and that IS a cross join after all and for that it displays all combination of data can be produced from the tables you have. As you have 3 tables you see data 3 times...
You have to learn about SQL joins and how to use them...
http://en.wikipedia.org/wiki/Join_(SQL)[^]
Visual Representation of SQL Joins[^]
 
Share this answer
 
Comments
Member 11065510 7-Oct-14 7:48am    
my problem is these three tables contain same column names
Kornfeld Eliyahu Peter 7-Oct-14 7:50am    
That is the good part! But sing fully qualified column names can get you over it!
MyTable1.Id, MyTabl2.Id and so on...

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