Received: from trends.net (root@clio.trends.ca [209.47.148.2]) by hub.org (8.9.3/8.9.1) with ESMTP id WAA00794 for ; Thu, 22 Apr 1999 22:48:18 -0400 (EDT) (envelope-from chris.bitmead@bigfoot.com) Received: from localhost.localdomain (h246.ozemail2.ozemail.com.au [203.108.14.246]) by trends.net (8.8.8/8.8.8) with ESMTP id WAA24819 for ; Thu, 22 Apr 1999 22:29:38 -0400 (EDT) Received: from bigfoot.com (localhost [127.0.0.1]) by localhost.localdomain (8.8.7/8.8.7) with ESMTP id MAA00689 for ; Fri, 23 Apr 1999 12:30:33 +1000 Sender: chris@localhost.localdomain Message-ID: <371FDB49.7E7FBA35@bigfoot.com> Date: Fri, 23 Apr 1999 02:30: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: <20211.924828306@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Tom Lane wrote: > > Chris Bitmead writes: > > Clever. But why doesn't this work.... > > > select title, summary, time from story t where time = (select > > max(s.time) from story s GROUP BY s.title); > > ERROR: parser: Subselect has too many or too few fields. > > A subselect used in an expression has to return exactly one value; > yours will return as many tuples as there are distinct titles. Why doesn't replacing "=" with "IN" produce a result? It wouldn't be the desired result, but I thought this was legal.