Convert Oracle outer join query to PostgreSql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hergele
    New Member
    • Sep 2008
    • 2

    Convert Oracle outer join query to PostgreSql

    Hello all.. I am trying to convert an application which is working on Oracle to postgreSql..
    I've seen a query in code something like this...

    Code:
    select  *
    from    table1 a1 , table1 a2, table2 a3,        
    where   a1.childid = a2.parentid(+)
    and     a2.childtype (+)= 'Something'
    and     a2.parenttype (+)= 'Something'
    and     a2.childid = a3.id (+)
    It's been used oracle iso99 style (+) outer join as you see..

    But..I've searched google, other forums.. But i can't convert this query to postgreSql..(my mind is stopped)
    Postgre wants me to use LEFT JOIN RIGHT JOIN, and wants me to use this after the FROM word..
    So.. I am confused. Have you got any idea for this query?

    Thanks in advance..
    Last edited by eWish; Oct 29 '08, 11:51 PM. Reason: Please use the code tags
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Try
    [CODE=sql]select *
    from table1 a2
    left join table1 a1 on (a1.childid = a2.parentid)
    right join table2 a3 on (a2.childid = a3.id)
    where ( a2.childtype = 'Something' or a2.childtype is null)
    and ( a2.parenttype = 'Something' or a2.parenttype is null)[/CODE]

    Comment

    Working...