Re: [SQL] Sorting problem

2004-07-16 Thread Stu
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 ---

Re: [SQL] Sorting problem

2004-07-16 Thread Stephan Szabo
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'

[SQL] Sorting problem

2004-07-16 Thread Ruggero
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--

Re: [SQL] Sorting problem

2003-10-16 Thread R. van Twisk
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:

Re: [SQL] Sorting problem

2003-10-15 Thread Jean-Luc Lachance
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

Re: [SQL] Sorting problem

2003-10-14 Thread Stephan Szabo
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

[SQL] Sorting problem

2003-10-14 Thread George A.J
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.