Sorting Challenge - Mailing list pgsql-novice

From
Subject Sorting Challenge
Date
Msg-id 20050830225840.62837.qmail@web33315.mail.mud.yahoo.com
Whole thread Raw
In response to Re: Copy Failure  (<operationsengineer1@yahoo.com>)
Responses Re: Sorting Challenge
List pgsql-novice
hi all,

i have another sorting problem.  i have data that
looks like...

sm2
sm101

i have a lot more data like this, but i want to keep
it simple.  the first two alphas represent an area and
the foloowing digit(s) represent a unique id.

the data is currently held in a text field.

i'm using (this is trimmed down)...

$sql_ipc_defect_code = 'SELECT code, code || \' - \'
|| description FROM defect ORDER BY LOWER(code) ASC';

this will list sm101 prior to sm2, which i think it
expected given my current order scheme.  but it isn't
what i want.

is there a way to sort this so that sm2 will come
before sm101?  do i need to change my data types?

tia...



____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs


pgsql-novice by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Copy function syntax on 8.1
Next
From: Tom Lane
Date:
Subject: Re: Copy function syntax on 8.1