From: | Chris Johnson <cmj(at)inline-design(dot)com> |
---|---|
To: | paul(at)MullenInc(dot)com |
Cc: | pgsql-general(at)postgreSQL(dot)org |
Subject: | Re: [GENERAL] Alphabetical sorting... |
Date: | 1998-07-06 21:20:28 |
Message-ID: | Pine.LNX.3.96.980706171634.6405A-100000@boreus.bedfo.ma.tiac.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
> >
> >
> >
> >
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Lynch | 1998-07-07 00:32:02 | Re: [GENERAL] Alphabetical sorting... |
Previous Message | James Olin Oden | 1998-07-06 21:06:49 | Re: [GENERAL] Varchar and varchar2 |