Re: ERROR: for SELECT DISTINCT, ORDER BY expressions must

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: ERROR: for SELECT DISTINCT, ORDER BY expressions must
Дата
Msg-id 20050314065442.U6400@megazone.bigpanda.com
обсуждение исходный текст
Ответ на ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list  (Gourish Singbal <gourish@gmail.com>)
Список pgsql-admin
On Mon, 14 Mar 2005, Gourish Singbal wrote:

> The Query needs to have the distinct clause in the select statement
> and the UPPER clause in the order by clause.
>
> eg.
> select distinct id, type from user_list order by UPPER(type)
>
> Please let me know if there is any solution to this issue
> thanks in advance.

I think you can break the select distinct into a subselect like
 select * from (select distinct id, type from user_list) a order by
upper(type)

Note, that if you were to ever have two strings that were considered the
same in type but which upper-case differently, the query would give
non-deterministic results.

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

Предыдущее
От: David Wagoner
Дата:
Сообщение: Log to Syslog or rotatelogs? Advice Please
Следующее
От: Thomas F.O'Connell
Дата:
Сообщение: Re: Performance Question