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: > >
In-line view IS the way to get the result you want :
select m1.whatever, c.whatever
from (
select m.whatever,
nvl((select max(seq) from childtable c where maintableseq=m.seq),0) childmaxseqfrom maintable m
In the inner query you have your where clause on maintable and you take care of selecting the max seq number for the child. nvl is used to make sure childmaxseq does not contain a null. If you have the possibility of seq=0, then replace the zero in my example with something seq can never be (-1 for example).
KiBeHa Received on Mon Feb 09 2004 - 03:08:16 CST
![]() |
![]() |