> > From: pgsql-general-owner@xxxxxxxxxxxxxx [mailto:pgsql-general- > > owner@xxxxxxxxxxxxxx] On Behalf Of Brandon Metcalf > > Sent: Friday, July 10, 2009 12:16 PM > > Change it to this: Sorry, I forgot that you need to split the GROUP BY clause as well in a similar manner to the WHERE clause. And unless you have duplicate rows to eliminate, use UNION ALL rather than UNION for a speed increase. Matthew Hartman Programmer/Analyst Information Management, ICP Kingston General Hospital .now. -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general