Re: [SQL] case-insensitive SORT BY?

From: Chris Johnson <cmj(at)inline-design(dot)com>
To: Richard Lynch <lynch(at)lscorp(dot)com>
Cc: Patrick Giagnocavo <pgiagnoc(at)qi(dot)com>, pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] case-insensitive SORT BY?
Date: 1998-09-23 12:47:09
Message-ID: Pine.LNX.4.00.9809230845380.27650-100000@boreus.bedfo.ma.tiac.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Perhaps this should go in the FAQ? I asked it myself several months ago.

Also note that you probably want to sort by key followed by name ( ie ...
sort by key, name) so that you don't run the risk of getting something
like:

a
A
B
b

Chris
--
I am at one with my duality.

On Tue, 22 Sep 1998, Richard Lynch wrote:

> Cheat. Get the name back, *AND* a second "field" with the name in upper
> case, and then sort by that upper-cased name. EG:
>
> "select name, upper(name) as key where name like '%clinton%' sort by key"
>
> At 3:53 PM 9/22/98, Patrick Giagnocavo wrote:
> >I am trying to ensure that when I do a SORT BY I get back the results in
> >normal sorted order instead of case-sensitive order. The WHERE clause
> >contains a LIKE '%..%' so I cannot use UPPER here in a way that does
> >what I want.
> >
> >e.g. , given
> >
> >A, B, b, a
> >
> >as data, the normal SORT BY behavior returns
> >
> >a
> >b
> >A
> >B
> >
> >How do I make it return
> >
> >a
> >A
> >b
> >B
> >
> >instead?
>
> --
> --
> -- "TANSTAAFL" Rich lynch(at)lscorp(dot)com
>
>
>

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Sferacarta Software 1998-09-23 13:45:53 Re: [SQL] 2 questions.
Previous Message Chris Johnson 1998-09-23 12:44:49 Re: [SQL] 2 questions.