pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
2+ messages / 2 participants
[nested] [flat]
* ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
@ 2005-03-14 10:00 Gourish Singbal <gourish@gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: Gourish Singbal @ 2005-03-14 10:00 UTC (permalink / raw)
To: pgsql-admin
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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: ERROR: for SELECT DISTINCT, ORDER BY expressions must
@ 2005-03-14 15:01 Stephan Szabo <sszabo@megazone.bigpanda.com>
parent: Gourish Singbal <gourish@gmail.com>
0 siblings, 0 replies; 2+ messages in thread
From: Stephan Szabo @ 2005-03-14 15:01 UTC (permalink / raw)
To: Gourish Singbal <gourish@gmail.com>; +Cc: 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.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2005-03-14 15:01 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-03-14 10:00 ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list Gourish Singbal <gourish@gmail.com>
2005-03-14 15:01 ` Re: ERROR: for SELECT DISTINCT, ORDER BY expressions must Stephan Szabo <sszabo@megazone.bigpanda.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox