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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query help

Author  Topic 

drpkrupa
Yak Posting Veteran

74 Posts

Posted - 2006-09-25 : 10:12:00

select t1.inst_no as Dealer,
t1.cs_no,
t3.csid,
T2.ISCREDITCARD
from 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_no

It give me error at in clause

what 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.ISCREDITCARD
from 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 end
left outer join accounts_unique as t3 on t1.cs_no = t3.cs_no
Go to Top of Page
   

- Advertisement -