Re: please need help: alpha numeric sorting

From: Ludwig Lim <lud_nowhere_man(at)yahoo(dot)com>
To: "Duncan Adams (DNS)" <duncan(dot)adams(at)vcontractor(dot)co(dot)za>
Cc: Postgres Mailing List <pgsql-novice(at)postgresql(dot)org>
Subject: Re: please need help: alpha numeric sorting
Date: 2002-08-02 09:31:13
Message-ID: 20020802093113.38663.qmail@web40006.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


--- "Duncan Adams (DNS)"
<duncan(dot)adams(at)vcontractor(dot)co(dot)za> wrote:
> u could try
>
> select <field1> || '.' || <field2> as foo from bar
>
> all though that still leaves me stuck.

-what about
select <field1> || '.' || <field2> as foo
from bar
order by to_number(<field1>,'9999'),
to_number(<field2>,'9999');

Assuming that both <field1> and <field2> are
alphanumeric characters. This forces numeric sorting
by converting <field1> and <field2> to numbers.

ludwig.

__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Oliver Elphick 2002-08-02 09:40:56 Re: please need help: alpha numeric sorting
Previous Message Markus Wollny 2002-08-02 09:26:51 Re: please need help: alpha numeric sorting