Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2004
    Posts
    26

    Question Unanswered: SQLServer equivalent for Oracle JOIN query.

    Hi,

    Could anyone tell me what is the MSSQLServer equivalent of the following Oracle query?.

    SELECT v1.cat, v1.gnr, TA1.desccde, v1.type, v1.cde
    FROM view1 v1, table1 TA,
    table1 TA1, table1 TA2, table1 TA3
    WHERE
    TA.txtcde (+) = TRIM(v1.cat)
    AND TA1.txtcde (+) = TRIM(v1.gnr)
    AND TA2.txtcde (+) = v1.cde
    AND TA3.txtcde (+) = TRIM(v1.type)

    Thanks,
    Gopi.
    Follow your DREAMS...
    Last edited by gopidba; 12-06-04 at 11:24. Reason: Simple

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Code:
    select distinct
           inf.avidbkey
         , ttl.titl
         , inf.cat
         , lk.desccde
         , inf.gnr
         , gnr.desccde as gnrtxt
         , inf.cueshttyp
         , lkcsh.desccde
         , inf.soccde
      from v_avi_info_lbl inf
    inner
      join v_avi_titl_lbl ttl
        on inf.avidbkey = ttl.avidbkey
       and inf.cat = ttl.cat
       and ttl.titl like 'RA%'
       and ttl.titl = 'OT'
    left outer
      join cds_lkup lk
        on trim(inf.cat) = lk.txtcde
       and lk.lng = 'EN'
       and lk.lkupid = 'CAT'
       and lk.dmncde = 'AVI'
    left outer
      join cds_lkup gnr
        on trim(inf.gnr) = gnr.txtcde
       and gnr.lng = 'EN'
       and gnr.lkupid = 'GNR'
       and gnr.dmncde = 'AVI'
    left outer
      join cds_lkup lksoc
        on inf.soccde = lksoc.txtcde
       and lksoc.lkupid = 'SOC'
       and lksoc.dmncde = 'AVI'
    left outer
      join cds_lkup lkcsh 
        on trim(inf.cueshttyp) = lkcsh.txtcde
       and lkcsh.lng = 'EN'
       and lkcsh.lkupid = 'CUE'
       and lkcsh.dmncde = 'AVI'
     where inf.cat = 'F'
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    my reply is the equivalent of the query that you originally posted

    you can work out the equivalent to the edited query yourself, okay?

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  4. #4
    Join Date
    Nov 2004
    Posts
    26
    Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •