Pop text in front of that first value and it works:
template1=# select text '##107990'
template1=# as "sortfield"
template1-# union
template1-# select '###17990'
template1-# order by sortfield;
sortfield
---
On Mon, 12 Jul 2004, Ruggero wrote:
> Hi all,
> I have a problem sorting varchar fields.
> I will explain the problem with a simple example:
>
> this query
>select '##10' as sortfield
>union
>select '###1' as sortfield
>order by sortfield
> produces this correct output:
>'###1'
Hi all,
I have a problem sorting varchar fields.
I will explain the problem with a simple example:
this query
select '##10' as sortfield
union
select '###1' as sortfield
order by sortfield
produces this correct output:
'###1'
'##10'
but this one
select '##10--
I think what you actually want is natural sorting.
Ries
> -Oorspronkelijk bericht-
> Van: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Jean-Luc Lachance
> Verzonden: woensdag 15 oktober 2003 17:43
> Aan: George A.J
> CC: [EMAIL PROTECTED]
> Onderwerp: Re:
You are obviously not using C locale.
If you can't change it for some reason, you can use:
select * from accounts order by int4( trim( acno, '#'));
JLL
"George A.J" wrote:
>
> hi all,
> i am using postgres 7.3.2 .i am converitng a mssql database to
> postgres.
> now i am facing a strange proble
On Tue, 14 Oct 2003, George A.J wrote:
> hi all,
> i am using postgres 7.3.2 .i am converitng a mssql database to postgres.
> now i am facing a strange problem. sorting based on a varchar field is not working
> as expected. the non alphanumeric characters are not sorting based on the ascii
> valu
hi all,
i am using postgres 7.3.2 .i am converitng a mssql database to postgres.
now i am facing a strange problem. sorting based on a varchar field is not working
as expected. the non alphanumeric characters are not sorting based on the ascii
value of them.
i have the following table structure.