On Wed, Sep 03, 2003 at 22:52:44 -0400,
LH <_pgsql-novice_@geekhouse.no-ip.com> wrote:
> So lets say I got a table A(x,y,z, Q) ordered by column Q, with contents
> like so:
>
> But that kills the order of the subquery. I've tried group by x,y,z but
> then I can't ORDER BY Q.
I think you can do something like this:
select x, y, z from
(select distinct on (x, y, z) x, y, z, q order by x, y, z, q)
order by q;