X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 60D7453FC5 for ; Fri, 15 Apr 2005 08:56:56 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75463-08 for ; Fri, 15 Apr 2005 11:56:51 +0000 (GMT) Received: from m-monitor.net (unknown [207.44.134.28]) by svr1.postgresql.org (Postfix) with ESMTP id 5D2A153FBB for ; Fri, 15 Apr 2005 08:56:51 -0300 (ADT) Received: (qmail 23615 invoked from network); 15 Apr 2005 11:56:54 -0000 Received: from 203-206-51-107.dyn.iinet.net.au (HELO ?127.0.0.1?) (203.206.51.107) by ev1s-207-44-134-28.ev1servers.net with SMTP; 15 Apr 2005 11:56:54 -0000 Message-ID: <425FAC67.2050203@meerkatsoft.com> Date: Fri, 15 Apr 2005 21:58:31 +1000 From: Alex User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-general@postgresql.org Subject: SQL Question Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.037 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200504/655 X-Sequence-Number: 76568 Hi, i have a table ProdId | LastUpdate -------+------------ 100 | 2005-04-01 100 | 2005-03-01 100 | 2005-02-01 200 | 2005-04-01 200 | 2005-03-01 200 | 2005-02-01 - How can i select only the newest record for each ProdId ? 100 | 2005-04-01 200 | 2005-04-01 - How can i select to retrieve the last 2 dates in record 100 | 2005-04-01 | 2005-03-01 200 | 2005-04-01 | 2005-03-01 Thanks Alex