| From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
|---|---|
| To: | Gourish Singbal <gourish(at)gmail(dot)com> |
| Cc: | PgSQL Admin <pgsql-admin(at)postgresql(dot)org> |
| Subject: | Re: ERROR: for SELECT DISTINCT, ORDER BY expressions must |
| Date: | 2005-03-14 15:01:56 |
| Message-ID: | 20050314065442.U6400@megazone.bigpanda.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Thomas F.O'Connell | 2005-03-14 15:58:53 | Re: Performance Question |
| Previous Message | David Wagoner | 2005-03-14 14:37:27 | Log to Syslog or rotatelogs? Advice Please |