collating advice - Mailing list pgsql-general

From Laurette Cisneros
Subject collating advice
Date
Msg-id Pine.LNX.4.44.0207111414390.16757-100000@visor.corp.nextbus.com
Whole thread Raw
Responses Re: collating advice
List pgsql-general
How to sort a text column in numerical order?

I have a text column in a table:

...
col2   text
...

which can contains values that are both number and a combination of numeric
and text:

1
1a
2
2a
2b
10
12
12a
etc.

Of course, they aren't entered into the table in any particular order.

A select like this:

select * from tablex order by col2;

returns this:

10
12
12a
1
1a
2a
2b

what we would like to get is:
1
1a
2
2a
2b
10
12
12a

Any ideas on how to achieve this?

Thanks,

--
Laurette Cisneros
The Database Group
(510) 420-3137
NextBus Information Systems, Inc.
www.nextbus.com
----------------------------------
"Intelligence complicates. Wisdom simplifies."
  -- Mason Cooley


pgsql-general by date:

Previous
From: Andreas Plesner Jacobsen
Date:
Subject: Re: SELECT...FOR UPDATE
Next
From: Stephan Szabo
Date:
Subject: Re: SELECT...FOR UPDATE