Re: numeric SORT order

From: "Mitch Vincent" <mitch(at)doot(dot)org>
To: "Ben Ausden" <benedict(at)navyblue(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: numeric SORT order
Date: 2002-01-28 21:07:14
Message-ID: 00da01c1a83f$c3c35910$0200000a@Mitch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

select * from whatever order by field1::text::integer;

seems to work..

----- Original Message -----
From: "Ben Ausden" <benedict(at)navyblue(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Sent: Monday, January 28, 2002 1:47 PM
Subject: [GENERAL] numeric SORT order

> Hi,
>
>
> Is there any way to persuade postgresql to sort a VARCHAR column in
numeric
> order first, and then text order?
>
> e.g
>
> 1, 2, 3, 10, 20, 25, 30, 40
>
> instead of:
>
> 1, 10, 2, 20, 25, 3, 30, 40
>
>
> From looking at the docs it seems that sort order is determined by the
> locale settings. Is this right, and would setting my locale to en_US cause
> postgres to use a different sort order?
>
>
> thanks,
> ben
>
> --
> ben ausden
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Allan Engelhardt 2002-01-28 21:19:21 Re: numeric SORT order
Previous Message Trond Eivind =?iso-8859-1?q?Glomsr=F8d?= 2002-01-28 20:57:24 Re: NEWBIE: Can't unpack RPMs