X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 08B8C56671 for ; Mon, 14 Mar 2005 15:02:00 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46037-05 for ; Mon, 14 Mar 2005 15:01:54 +0000 (GMT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id A43485666B for ; Mon, 14 Mar 2005 15:01:54 +0000 (GMT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 9962D3555C; Mon, 14 Mar 2005 07:01:56 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 978BA354F4; Mon, 14 Mar 2005 07:01:56 -0800 (PST) Date: Mon, 14 Mar 2005 07:01:56 -0800 (PST) From: Stephan Szabo To: Gourish Singbal Cc: PgSQL Admin Subject: Re: ERROR: for SELECT DISTINCT, ORDER BY expressions must In-Reply-To: <674d1f8a050314020068b6c0c8@mail.gmail.com> Message-ID: <20050314065442.U6400@megazone.bigpanda.com> References: <674d1f8a050314020068b6c0c8@mail.gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/208 X-Sequence-Number: 16706 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.