Re: Best way to do this query?
From: Cimode <cimode_at_hotmail.com>
Date: 15 Jan 2007 02:18:32 -0800
Message-ID: <1168856312.541187.60740_at_v45g2000cwv.googlegroups.com>
Date: 15 Jan 2007 02:18:32 -0800
Message-ID: <1168856312.541187.60740_at_v45g2000cwv.googlegroups.com>
Marshall wrote:
> But suppose I also want to know the id and amount of that particular
select * from Invoices A
> invoice?
Something like this should do...
inner join
(
select invoiceid, max(date) as date1 from Invoices group by customerid
) B
on A.invoiceid = B.invoiceid and
A.date = B.date1
Hope this helps... Received on Mon Jan 15 2007 - 11:18:32 CET