x

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
more ▼

asked Jul 28, 2010 at 03:02 AM in Default

xuanyang gravatar image

xuanyang
11 1 1 1

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first
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
more ▼

answered Jul 28, 2010 at 03:09 AM

Matt Whitfield gravatar image

Matt Whitfield ♦♦
29.5k 61 65 87

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x991
x122

asked: Jul 28, 2010 at 03:02 AM

Seen: 1274 times

Last Updated: Jul 28, 2010 at 03:05 AM