Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 45859475B68 for ; Mon, 9 Sep 2002 04:08:33 -0400 (EDT) Received: from mail2.tpgi.com.au (mail.tpgi.com.au [203.12.160.58]) by postgresql.org (Postfix) with ESMTP id 2401A475AD4 for ; Mon, 9 Sep 2002 04:08:29 -0400 (EDT) Received: from jac (bri5-56k-198.tpgi.com.au [203.213.6.198]) by mail2.tpgi.com.au (8.11.6/8.11.6) with SMTP id g8988OI20525; Mon, 9 Sep 2002 18:08:25 +1000 Message-ID: <000701c257d8$1163c9a0$1400a8c0@jac> From: "jack" To: "dima" <_pppp@mail.ru> Cc: References: <002201c25796$d923d3f0$1400a8c0@jac> <3D7C4108.70407@mail.ru> Subject: Re: the best way to get the topest 3 record in every group Date: Mon, 9 Sep 2002 18:08:21 +1000 MIME-Version: 1.0 Content-Type: text/plain; charset="KOI8-R" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/35 X-Sequence-Number: 9312 Dima My question is that I want to produce ALL the lastest 3 records for EACH itemNo and supplier. Jack ----- Original Message ----- From: "dima" <_pppp@mail.ru> To: "jack" Cc: Sent: Monday, September 09, 2002 4:34 PM Subject: Re: [SQL] the best way to get the topest 3 record in every group > > 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 > ??? > >