Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL: Full outer join?
For my understanding, the large table should go to right side when join. Don't know if that's also the rule in this case. Anyone clarify?
JK
Jr. DBA, MMI
Martin Haltmayer <Martin.Haltmayer_at_d2mail.de> wrote in message news:<3B40CC8E.C4EBB29D_at_d2mail.de>...
> write
>
> select a.*, b.*
> from (select a.* from a, b where a.pk (+) = b.pk) a, b
> where a.pk = b.pk (+)
>
> Another option would be
>
> select a.*, b.*
> from a, b, (select a.pk from a union select b.pk from b) c
> where c.pk = a.pk (+)
> and c.pk = b.pk (+)
>
> Which is fastest?
>
> Martin
>
>
>
> Vikas Agnihotri wrote:
> >
> > How can I write a SQL for the following 2-table join?
> >
> > Based on the PK, Table A has 0 or 1 matching values. Table B has 0 or
> > 1 matching values.
> >
> > i.e. where A.pk = B.pk(+) or B.pk = A.pk (+)
> >
> > Is the above valid? Or do I need
> >
> > select... where a.pk=b.pk(+)
> > union
> > select .... where b.pk=a.pk(+)
> >
> > Any other efficient approaches?
> >
> > Thanks
Received on Tue Jul 10 2001 - 04:26:23 CDT
![]() |
![]() |