Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> Greg Stark <gsstark(at)mit(dot)edu> writes:
> > slo=> explain
> > select *
> > from (select foo_id,count(*) as n from foo_bar group by foo_id) as x
> > join (select * from foo limit 1) as foo using (foo_id)
> > ;
>
> Why not put the subselect in the output list, if that's the kind of plan
> you want?
Actually that's the way the query is right now. The problem arises because I
want to add a second column without duplicating the whole thing.
--
greg