Re: [SQL] removing duplicates and using sort

2013-09-16 Thread Edward W. Rouse
Change the order by to order by lastname, firstname, refid, appldate From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Nathan Mailg Sent: Saturday, September 14, 2013 10:36 PM To: pgsql-sql@postgresql.org Subject: [SQL] removing duplicates and using sort

Re: [SQL] removing duplicates and using sort

2013-09-16 Thread David Johnston
Note that you could always do something like: WITH original_query AS ( SELECT DISTINCT ... ) SELECT * FROM original_query ORDER BY lastname, firstname; OR SELECT * FROM ( SELECT DISTINCT ) sub_query ORDER BY lastname, firstname I am thinking you cannot alter the existing ORDER BY other