| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Best way to do this query?
Tonkuma wrote:
> Cimode wrote:
> >
> > SELECT I.*
> > FROM Invoices I
> > INNER JOIN
> > (SELECT customerid, max(invoiceid) invoiceid, MAX(date) most_recent_date
> > FROM Invoices
> > GROUP BY customerid
> > ) AS C
> > ON I.customerid = C.customerid and
> > AND I.date = C.most_recent_date
> >
> > -->returns
> > 3 John 2001-01-03 300
> > 4 John 2001-01-03 500
>
![]() |
![]() |