Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Outer Join Problem with columns from Multiple tables
we need to do outer joins to a table using fields from two different
tables.
e.g we have a table called ZZZ_ITEM_SUPP which we need to do an
outer join to using SUPP_CODE from ZZZ_PO and ITEM_CODE from ZZZ_POL.
SQL server has no problem with this but ORACLE gives error (ORA-01417 a table may be outer joined to at most one other table)
the only statement I have been able to come up with so far for ORACLE is :-
SELECT L.PO_TXN_REF, L.POL_NUM, C.DESCR
FROM ZZZ_ITEM_SUPP C, (SELECT PO.PO_TXN_REF, POL.POL_NUM, SUPP_CODE,
ITEM_CODE
FROM ZZZ_PO PO, ZZZ_POL POL
WHERE PO.PO_TXN_REF = POL.PO_TXN_REF) L
WHERE L.SUPP_CODE = C.SUPP_CODE(+)
AND L.ITEM_CODE = C.ITEM_CODE(+)
AND L.PO_TXN_REF = 'PO-MARG01'
As you can see this means doing a sub-select thus reducing performance
to achieve the desired result.
Is there a better way of doing this ? Received on Wed Aug 18 1999 - 08:58:40 CDT