Received: from localhost.localdomain (h246.ozemail2.ozemail.com.au [203.108.14.246]) by hub.org (8.9.3/8.9.1) with ESMTP id AAA12277 for ; Fri, 23 Apr 1999 00:37:56 -0400 (EDT) (envelope-from chris.bitmead@bigfoot.com) Received: from bigfoot.com (localhost [127.0.0.1]) by localhost.localdomain (8.8.7/8.8.7) with ESMTP id OAA01082 for ; Fri, 23 Apr 1999 14:39:33 +1000 Sender: chris@localhost.localdomain Message-ID: <371FF985.FA06E59B@bigfoot.com> Date: Fri, 23 Apr 1999 04:39:33 +0000 From: Chris Bitmead X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.0.36 i686) X-Accept-Language: en MIME-Version: 1.0 To: "pgsql-sql@postgresql.org" Subject: Re: [SQL] Finding the "most recent" rows References: <20915.924840503@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Tom Lane wrote: > > Chris Bitmead writes: > >>>> select title, summary, time from story t where time = (select > >>>> max(s.time) from story s GROUP BY s.title); > > > Why doesn't replacing "=" with "IN" produce a result? It wouldn't be the > > desired result, but I thought this was legal. > > I thought so too (on both counts). Are you saying it doesn't work? > What happens? Which version are you using? httpd=> select title, summary, time from story t where time IN (select max(s.time) from story s GROUP BY s.title); ERROR: parser: Subselect has too many or too few fields. I'm using postgresql-snap-990329.tgz