hey..
i have two tables having three same columns..
so when i m using join on them its not returning me any output..
is it is necessary only to have a single matching column???
plz help..........
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Suthish NairPosted Nov 6, 2011, 9:02 AM
Syed Nayab AliPosted Nov 4, 2011, 2:35 PM
it is not necessary to make join only on one column.
Multiple column can be use in join, it will help you to filter data more specificly.
Try to use following syntax to get result
Select a.column1, a.column3, b.column2 from Table1 a join Table2 b
on a.column1 = b.column1
and a.column2 = b.column2
and a.column3 = b.column3
I m not understanding why u r not getting any return,
can you put ur code here so we can find out mistake.
Thanks
Please click on "Accepted Answer" if it helps you
Pravin MorePosted Nov 4, 2011, 5:13 AM
see, we apply join on two tables n here you hav 1 common column between table1 n table 2 and table2 n table 3......
so can have join.
e.g:- select * from table1 t1 join table2 t2 on t1.t1colmn=t2.t1colmn
join table3 t3 on t2.t2colmn=t3.t2colmn
thats it......
Thanks,
Pravin.
Akash AhlawatPosted Nov 4, 2011, 2:20 AM
Akash AhlawatPosted Nov 4, 2011, 2:20 AM
Pravin MorePosted Nov 4, 2011, 1:33 AM
Akash AhlawatPosted Nov 4, 2011, 1:26 AM
Pravin MorePosted Nov 4, 2011, 12:41 AM
no, its not necessary to have join on single column......
but data is not coming might be because of their is no matching data for strictly all 3 joins......so better is put join on single peimary key column.
Thanks,
Pravin.