Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
select t1.inst_no as Dealer, t1.cs_no, t3.csid,T2.ISCREDITCARDfrom account as t1 left outer join payment as t2 on t2.cs_no = case (t1.inst_no in (401700,300700)) then t3.csid else t1.cs_no end)left outer join accounts_unique as t3 on t1.cs_no = t3.cs_noIt give me error at in clausewhat i want a do i want join three table.if t1.inst in 400700, 300700 then i want a join t2 to t3 else t2 to t1
snSQL
Master Smack Fu Yak Hacker
1837 Posts
Posted - 2006-09-25 : 10:18:11
Try this
select t1.inst_no as Dealer, t1.cs_no, t3.csid,T2.ISCREDITCARDfrom account as t1 left outer join payment as t2 on t2.cs_no = case when t1.inst_no in (401700,300700) then t3.csid else t1.cs_no endleft outer join accounts_unique as t3 on t1.cs_no = t3.cs_no