Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Outer Join to a subquery alternative?
John wrote:
> Oracle doesnt like
>
> select whatever
> from maintable m,
> childtable c
> where c.seq(+)=(select max(seq) from childtable c where maintableseq=m.seq)
>
> because it wont allow outer joins to a subquery. If I strip the (+) out,
> then I only get records from maintable which have an entry in childtable -
> I need them even if there isnt an entry in childtable.
>
> Any ideas for a workaround?
>
> Oracle 8.1.7.latest SE.
>
> Thanks!
Your hint is in your question, to do an OUTER JOIN, you need to do a JOIN
first. IOW, get rid of the subquery.
If that not enough of a hint, here's a second one. Don't peek unless you really need it.
ready?
look up the phrase "in-line view"
HTH (I really do)
-- Ed Prochak running http://www.faqs.org/faqs/running-faq/ netiquette http://www.psg.com/emily.html -- "Two roads diverged in a wood and I I took the one less travelled by and that has made all the difference." robert frostReceived on Thu Feb 05 2004 - 06:36:35 CST