From: | "Peter Darley" <pdarley(at)kinesis-cem(dot)com> |
---|---|
To: | "Jon Lapham" <lapham(at)extracta(dot)com(dot)br>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Ordering 'A', 'B', ..., 'Z', 'AA', 'AB', ... |
Date: | 2002-02-20 22:19:13 |
Message-ID: | NNEAICKPNOGDBHNCEDCPKELOCEAA.pdarley@kinesis-cem.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Jon,
How about "order by char_length(field), field"
Thanks,
Peter Darley
-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of Jon Lapham
Sent: Wednesday, February 20, 2002 11:47 AM
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] Ordering 'A', 'B', ..., 'Z', 'AA', 'AB', ...
Hello folks-
Does anyone have a suggestion on how to order a varchar(2) column
containing values like: 'A', 'B', ..., 'Z', 'AA', 'AB', ...
What I would like to to return the tuples in this order:
A
B
C
...
X
Y
Z
AA
AB
...
Instead of:
A
AA
AB
...
B
BA
BB
...
While I would prefer to do the ordering in SQL, my application is
written perl, so I could always do the ordering perl-ically.
Thanks in advance!
--
-**-*-*---*-*---*-*---*-----*-*-----*---*-*---*-----*-----*-*-----*---
Jon Lapham
Extracta Moléculas Naturais, Rio de Janeiro, Brasil
email: lapham(at)extracta(dot)com(dot)br web: http://www.extracta.com.br/
***-*--*----*-------*------------*--------------------*---------------
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Old | 2002-02-20 22:26:00 | test |
Previous Message | Stephan Szabo | 2002-02-20 22:01:08 | Re: question on function definitions/casts |