Re: [GENERAL] Alphabetical sorting... - Mailing list pgsql-general

From Chris Johnson
Subject Re: [GENERAL] Alphabetical sorting...
Date
Msg-id Pine.LNX.3.96.980706171634.6405A-100000@boreus.bedfo.ma.tiac.net
Whole thread Raw
In response to Re: [GENERAL] Alphabetical sorting...  (Paul Mullen <mullen@thecore.com>)
Responses libpq++ library  (Summer <summerd@cs.unm.edu>)
List pgsql-general
I don't know if the code given in the reply (THANK YOU PAUL!!!!) works for
6.3.2 (I'm downloading now to test it), but it failed in 6.3 with the
error 'ERROR:  parser: parse error at or near "("' - but it put me on the
right track.

I wound up using the following:
   select test, lower(test) as ltest from testtable order by ltest;

which *almost* gets it, but is close enough for me...

test |ltest
-----+-----
a    |a
A    |a
ABLE |able
Able |able
AXIOM|axiom

- notice that 'a' and 'A' are reversed... there was a 50/50 shot at it
being perfect, but that will happen in so few cases as to be irrelevant
(hopefully nobody will notice ;-)

Thanks all!

Chris

On Mon, 6 Jul 1998, Paul Mullen wrote:

> Chris,
>
> a and A are have different acsii codes
>
> try:
>
> select test from test order by lower(test)
>
> This should give you what you want.
>
> - Paul
>
> > HELP!
> >
> > Alphabetical sorting... is it broken or is this intentional.  If this is
> > not a "feature" anyone have any idea of how to actually sort
> > alphabetically on a text field?
> >
> > cmj=> create table test (test text);
> > CREATE
> > cmj=> insert into test values ('a');
> > INSERT 240009 1
> > cmj=> insert into test values ('A');
> > INSERT 240010 1
> > cmj=> insert into test values ('ABLE');
> > INSERT 240011 1
> > cmj=> insert into test values ('Able');
> > INSERT 240012 1
> > cmj=> insert into test values ('AXIOM');
> > INSERT 240013 1
> > select * from test order by test;
> > test
> > -----
> > A
> > ABLE
> > AXIOM
> > Able
> > a
> > (5 rows)
> >
> >
> > Thanks!
> > Chris
> >
> >
> >
> >
>
>


pgsql-general by date:

Previous
From: Roman Volkoff
Date:
Subject: unsubscribe
Next
From: lynch@lscorp.com (Richard Lynch)
Date:
Subject: Re: [GENERAL] Alphabetical sorting...