From: | Ben Ausden <benedict(at)navyblue(dot)com> |
---|---|
To: | "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org> |
Cc: | "'Mitch Vincent'" <mitch(at)doot(dot)org> |
Subject: | Re: numeric SORT order |
Date: | 2002-01-29 09:48:13 |
Message-ID: | 4174BB57B89ED411A8BB000102A30F51406156@NAVY |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
thanks Mitch.
the problem is that casting to int won't work for non-numeric data
(obviously), and I can't guarantee that values in this column will
definitely be numeric... I should have made that clearer in my post. Ideally
I'd like to sort numbers in numeric order and text in regular alphabetic
order, like: 1,2,3,40,50,a,b,c,d,e...[etc]
-ben
> -----Original Message-----
> From: Mitch Vincent [mailto:mitch(at)doot(dot)org]
> Sent: 28 January 2002 21:07
> To: Ben Ausden; pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] numeric SORT order
>
>
> 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 | Date | Subject | |
---|---|---|---|
Next Message | Karl DeBisschop | 2002-01-29 10:30:16 | Re: Pg_dump options |
Previous Message | Dmitry Alyabyev | 2002-01-29 09:45:57 | Re: Pg_dump options |