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 |
kwikwisi
Constraint Violating Yak Guru
283 Posts |
Posted - 2008-06-24 : 03:22:27
|
I want to join t1(Qid,Sid,Cid,...) with t2(Cid,...),t3(Sid,..),t4(Qid..)then i'll retreive required fields from thtese tables.Can u help me? |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-06-24 : 03:25:26
|
[code]select *from t1 inner join t2 on t1.Cid = t2.Cid inner join t3 on t1.Sid = t3.Sid inner join t4 on t1.Qid = t4.Qid[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
kwikwisi
Constraint Violating Yak Guru
283 Posts |
Posted - 2008-06-24 : 03:38:14
|
Changes alittle bit.(Can i join on different column name?)t1(Qid,Sid,...) with t3(Sid,..),t4(Qid,Cid,..) and join t4 with t2(Cid,...).Thanks.quote: Originally posted by khtan
select *from t1 inner join t2 on t1.Cid = t2.Cid inner join t3 on t1.Sid = t3.Sid inner join t4 on t1.Qid = t4.Qid KH[spoiler]Time is always against us[/spoiler]
|
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-24 : 03:39:23
|
quote: Originally posted by kwikwisi Changes alittle bit.(Can i join on different column name?)t1(Qid,Sid,...) with t3(Sid,..),t4(Qid,Cid,..) and join t4 with t2(Cid,...).Thanks.quote: Originally posted by khtan
select *from t1 inner join t2 on t1.Cid = t2.Cid inner join t3 on t1.Sid = t3.Sid inner join t4 on t1.Qid = t4.Qid KH[spoiler]Time is always against us[/spoiler]
you can. replace the columns in posted code with your linking columns |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-06-24 : 09:24:38
|
Also instead of *, specify the column names in the SELECT statementMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|