ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list

Поиск
Список
Период
Сортировка
Искать

ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list

От:
Gourish Singbal <gourish@gmail.com>
Дата:
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.
-- 
Best,
Gourish Singbal

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

От:
Stephan Szabo <sszabo@megazone.bigpanda.com>
Дата:
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.
FAQ