Hi Robert, > does this work for you? > Â Â Â Âselect u.id from (your unions) as u order by u.id Unfourtunatly not, it converts my union-results from INTEGER to RECORD. However, it seems to be possible to order the unions directly: > result1 UNION result2 ORDER BY u.id Hmm, the query plan looks really insane for this ... wonder how it will perform when the tables will not be mostly empty ;) Thanks, Clemens -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general