Re: [SQL] Finding the "most recent" rows

From: Chris Bitmead <chris(dot)bitmead(at)bigfoot(dot)com>
To: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgreSQL(dot)org>
Subject: Re: [SQL] Finding the "most recent" rows
Date: 1999-04-23 04:39:33
Message-ID: 371FF985.FA06E59B@bigfoot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Tom Lane wrote:
>
> Chris Bitmead <chris(dot)bitmead(at)bigfoot(dot)com> 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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Thomas Lockhart 1999-04-23 05:21:33 Re: [INTERFACES] where did that date and time come from??
Previous Message Brook Milligan 1999-04-23 04:10:04 Re: [SQL] Finding the "most recent" rows