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.
I think you meant
select title, summary, time from story t where time = (select
max(s.time) from story s WHERE s.title = t.title);
Here the subselect should give a single result each time it's
executed. Unfortunately, it's gonna be executed once for each
tuple scanned by the outer select :-(
regards, tom lane