Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
wisdomtree
Starting Member
1 Post |
Posted - 2008-10-20 : 04:11:15
|
| Hi I have come across a similar query which was written by my previous db developer. can any one explain how does this work and when should i use such queryselect * from (select a.x1,a.x2,.. from t1) a inner join(select b.x1,b,x2 from t2) bon (a.x1=b.x2)i am not sure whether the above code i wrote is right but hope it gives you an idea about what i am asking.Please help me out by giving some example so that i will be able to understandrgsbhanu |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-20 : 04:13:39
|
| its right. only problem is it wont need alises inside as aliases are defined for derived tables and wont be available insideselect * from (select x1,x2,.. from t1) a inner join(select x1,x2 from t2) bon (a.x1=b.x2) |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-10-20 : 04:17:10
|
| orselect a.columns,b.columns from t1 as a inner join t2 as b on (a.x1=b.x2)MadhivananFailing to plan is Planning to fail |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-20 : 04:47:33
|
quote: Originally posted by madhivanan orselect a.columns,b.columns from t1 as a inner join t2 as b on (a.x1=b.x2)MadhivananFailing to plan is Planning to fail
this is prefered way to do unless you dont have any specific calculations/dervivations to done on a any table column before joining. |
 |
|
|
|
|
|