t == t...@sss.pgh.pa.us writes: t> Brandon Metcalf <bran...@geronimoalloys.com> writes: t> > I tried moving the last group of WHERE, GROUP BY, and ORDER BY before t> > the UNION with the query it belongs to, but that results in a t> > different syntax error.
t> I think that's probably what you want to do. What you're missing is t> you need parentheses to put an ORDER BY into an arm of a UNION: t> (SELECT ... ORDER BY ...) UNION SELECT ... t> Otherwise it wants to consider the ORDER BY as applying to the UNION t> output. Indeed. It was the fact that I was trying to move the ORDER BY along with WHERE and GROUP BY that was giving me grief. Thanks. -- Brandon -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general