Re: removing duplicates and using sort

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: removing duplicates and using sort
Дата
Msg-id 1379342569452-5771096.post@n5.nabble.com
обсуждение исходный текст
Ответ на removing duplicates and using sort  (Nathan Mailg <nathanmailg@gmail.com>)
Ответы Re: removing duplicates and using sort
Список pgsql-sql
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 otherwise your use of
"DISTINCT ON" begins to mal-function.  I dislike DISTINCT ON generally but
do not wish to ponder how you can avoid it, so I'd suggest just turning your
query into a sub-query like I show above.

David J.




--
View this message in context:
http://postgresql.1045698.n5.nabble.com/removing-duplicates-and-using-sort-tp5770931p5771096.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.



В списке pgsql-sql по дате отправления:

Предыдущее
От: "Edward W. Rouse"
Дата:
Сообщение: Re: removing duplicates and using sort
Следующее
От: Nathan Mailg
Дата:
Сообщение: Re: removing duplicates and using sort