Right outer join

  • i have a query written for oracle that i want to convert so that it can be used in sql server. my problem is that i want to use right outer joins but i cant seem to get the joins right. here is the query that was written for oracle:

     

    SELECT CO.NAME, CP.GR_REF, CP.ACTIVE_PERIOD, CP.CRCODE,CP.PAYMENTDATE, CP.CLAIMID,

    CP.CSNO, SUM(CD.GRWAGES+CD.GRSUBSISTANCE+CD.GRTRAVEL+CD.GRCOURSE+CD.GRCONSULTANCY )GRSUM,

    ROUND(CT.GRTRAINOR) GRTRAINOR, 

    CP.GRNTTYPE, CP.CLAIMNO

    FROM  CLAIMSPERD_EMF CP, CLAIMSDETAIL_EMF CD, COMPANY CO, CLAIMSTRAINOR_EMF CT

    WHERE CP.CLAIMID = CD.CLAIMID(+)

    AND CP.CLAIMID = CT.CLAIMID(+)

     

    i would really appreciate any suggestions

     

    thanks

  • A quick and easy way is:

    WHERE CP.CLAIMID =* CD.CLAIMID

    AND CP.CLAIMID =* CT.CLAIMID


    ------------------------------
    The Users are always right - when I'm not wrong!

  • this worked well! i had to put the * on the lEft side of the = sign though cos i found out the (+) where iT was in the query used by oracle means a left join.

     

    thanks

  • I forgot that. I have not worked on oracle for about 18 months and it shows.


    ------------------------------
    The Users are always right - when I'm not wrong!

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply