[SQL] the best way to get the topest 3 record in every group

2002-09-08 Thread jack

Hi,
There is a table like :
<<
itemNo
supplier
purchaseDate
Price
Qty
<<
Please provide an idea if I want to get the latest 3 puchase records for
each item and supplier. Thank you in advance.

jack


---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



Re: [SQL] the best way to get the topest 3 record in every group

2002-09-08 Thread dima

> There is a table like :
> <<
> itemNo
> supplier
> purchaseDate
> Price
> Qty
> <<
> Please provide an idea if I want to get the latest 3 puchase records for
> each item and supplier. Thank you in advance.
select * from table_name where supplier=value order by purchaseDate desc 
limit 3
???



---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster