From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Gourish Singbal <gourish@gmail.com>
Cc: PgSQL Admin <pgsql-admin@postgresql.org>
Subject: Re: ERROR: for SELECT DISTINCT, ORDER BY expressions must
Date: Mon, 14 Mar 2005 07:01:56 -0800 (PST)
Message-ID: <20050314065442.U6400@megazone.bigpanda.com> (raw)
In-Reply-To: <674d1f8a050314020068b6c0c8@mail.gmail.com>
References: <674d1f8a050314020068b6c0c8@mail.gmail.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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: sszabo@megazone.bigpanda.com, gourish@gmail.com
Subject: Re: ERROR: for SELECT DISTINCT, ORDER BY expressions must
In-Reply-To: <20050314065442.U6400@megazone.bigpanda.com>
References: <674d1f8a050314020068b6c0c8@mail.gmail.com> <20050314065442.U6400@megazone.bigpanda.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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