question

xuanyang avatar image
xuanyang asked

Left Outer Join

I am always use the *= syntax for outer joins in sqlserver 2000, but I heard it's unsupported in 2005. May I know how to convert below statement in order make it workable when run in sqlserver 2005? Please advise. THANK YOU. Select M.ClmNoKey, C.CaseNoKey, M.VehNo, M.LsDt, C.ClmTypeCd, Ins, TPIns, TPBIInjured, RA + AdjRA + SolRA + InvRA + SpcRA + RibRA As GrossRA, ISNULL(ActID, '') AS ActID, ISNULL(ActName, '') As ActName, ClmCaseStatusCd, C.COUserCd Into #Temp From CMast, MCMast M, MCMastCase C, uWorkItemAttrib W, MCGblRpd Where CMast.ClmNoKey = M.ClmNoKey And M.ClmNoKey = C.ClmNoKey And C.ClmNoKey *= W.FileRefNo And C.CaseNoKey *= W.CaseNo And W.PayNo IS NULL And C.COUserCd = @ExaminerName And C.ClmTypeCd = @ClmTypeCd And C.ClmNoKey = MCGblRpd.ClmNoKey And C.CaseNoKey = MCGblRpd.CaseNoKey And StartDt Between @FromDt And @ToDt
t-sqljoins
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Matt Whitfield avatar image
Matt Whitfield answered
Select M.ClmNoKey, C.CaseNoKey, M.VehNo, M.LsDt, C.ClmTypeCd, Ins, TPIns, TPBIInjured, RA + AdjRA + SolRA + InvRA + SpcRA + RibRA As GrossRA, ISNULL(ActID, '') AS ActID, ISNULL(ActName, '') As ActName, ClmCaseStatusCd, C.COUserCd Into #Temp From CMast INNER JOIN MCMast M ON CMast.ClmNoKey = M.ClmNoKey INNER JOIN MCMastCase C ON M.ClmNoKey = C.ClmNoKey INNER JOIN MCGblRpd ON C.ClmNoKey = MCGblRpd.ClmNoKey AND C.CaseNoKey = MCGblRpd.CaseNoKey LEFT OUTER JOIN uWorkItemAttrib W ON C.ClmNoKey = W.FileRefNo AND C.CaseNoKey = W.CaseNo WHERE W.PayNo IS NULL And C.COUserCd = @ExaminerName And C.ClmTypeCd = @ClmTypeCd And StartDt Between @FromDt And @ToDt
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.