pgsql(at)peope(dot)net writes:> How can you use a distinct on () including the whole union.
In 7.1 you can write
select distinct ... from (select ... union select ...) ss;
regards, tom lane