Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C9321475B68 for ; Mon, 9 Sep 2002 02:34:54 -0400 (EDT) Received: from mx2.mail.ru (mx2.mail.ru [194.67.57.12]) by postgresql.org (Postfix) with ESMTP id E3C6C475B47 for ; Mon, 9 Sep 2002 02:34:53 -0400 (EDT) Received: from drweb by mx2.mail.ru with drweb-scanned (Exim MX.2) id 17oI8L-0008Sj-00; Mon, 09 Sep 2002 10:34:53 +0400 Received: from [213.128.193.142] (helo=mail.ru) by mx2.mail.ru with esmtp (Exim SMTP.2) id 17oI8L-0008Qa-00; Mon, 09 Sep 2002 10:34:53 +0400 Message-ID: <3D7C4108.70407@mail.ru> Date: Mon, 09 Sep 2002 10:34:48 +0400 From: dima <_pppp@mail.ru> User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.0.0) Gecko/20020816 X-Accept-Language: ru, en-us, en MIME-Version: 1.0 To: jack Cc: pgsql-sql@postgresql.org Subject: Re: the best way to get the topest 3 record in every group References: <002201c25796$d923d3f0$1400a8c0@jac> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit X-Envelope-To: datactrl@tpg.com.au, pgsql-sql@postgresql.org X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/34 X-Sequence-Number: 9311 > 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 ???