Re: [SQL] Finding the "most recent" rows - Mailing list pgsql-sql

From Chris Bitmead
Subject Re: [SQL] Finding the "most recent" rows
Date
Msg-id 371FDB49.7E7FBA35@bigfoot.com
Whole thread Raw
In response to Re: [SQL] Finding the "most recent" rows  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [SQL] Finding the "most recent" rows
List pgsql-sql
Tom Lane wrote:
> 
> Chris Bitmead <chris.bitmead@bigfoot.com> 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.


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: [SQL] Finding the "most recent" rows
Next
From: Chris Bitmead
Date:
Subject: Re: [SQL] SELECT TOP _x_ ??