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 |
|
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2009-03-25 : 10:52:56
|
| [code]I need a query which should pull the outputTable:CustA CID CName ------ ------ 1 Sam 2 Pat 3 Mat 4 Jef Table:CustB CID Comp ------ ----1 Van 2 Man 3 Mso Table:CustC CID Age ------ ----1 30 2 25 OutputCID CName Comp Age---- ----- ---- ---1 Sam Van 302 Pat Man 25 3 Mat Mso null 4 Jef null null[/code] |
|
|
heavymind
Posting Yak Master
115 Posts |
Posted - 2009-03-25 : 10:55:04
|
| select cn.cid, cname, comp, agefrom CustA cn left outer join CustB b on cn.cid = b.cid left outer join CustC con cn.cid = c.cidThanks, VadymMCITP DBA 2005/2008Chief DBA at http://www.db-staff.com |
 |
|
|
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2009-03-25 : 12:01:40
|
| Thanks!!I need to extend the query with filter conditions for the statusselect cn.cid, cname, comp, agefrom CustA cnleft outer join CustB b on cn.cid = b.cidleft outer join CustC con cn.cid = c.cidWhere (cn.Vstatus=5 and cn.Dstatus=0,cn.Tstatus in (5,0))and (b.Vstatus=5 and b.Dstatus=0,b.Tstatus in (5,0))correct the where conditions |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-03-25 : 13:11:18
|
quote: Originally posted by sqlfresher2k7 Thanks!!I need to extend the query with filter conditions for the statusselect cn.cid, cname, comp, agefrom CustA cnleft outer join CustB b on cn.cid = b.cidleft outer join CustC con cn.cid = c.cidWhere (cn.Vstatus=5 and cn.Dstatus=0,cn.Tstatus in (5,0))and (b.Vstatus=5 and b.Dstatus=0,b.Tstatus in (5,0))correct the where conditions
are you expecting spoon feeded answers? your question is straight forward. even after getting a pointer cant you extend it based on your reuirement? look in sql server books online and see how you write where condition rather than looking for spoon feeded answers.you wont gain anything by doing this. |
 |
|
|
|
|
|
|
|