Unix Technical Forum

sorting alphanum colum ..

This is a discussion on sorting alphanum colum .. within the MySQL forums, part of the Database Server Software category; --> happy visitors of Paris know about the 'arrondissement', an administrative division of the city... 20 selecting them from a ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 09:48 AM
Josselin
 
Posts: n/a
Default sorting alphanum colum ..

happy visitors of Paris know about the 'arrondissement', an
administrative division of the city... 20
selecting them from a city database brings them as

'Paris 1' , 'Paris 10' , 'Paris 11' , ..... 'Paris 19' , 'Paris 2' ,
'Paris 20' , 'Paris 3' , .... 'Paris 9'

is there any way to get them ordered as :
'Paris 1' , 'Paris 2' , 'Paris 3' , .... 'Paris 9' , 'Paris 10' ,
'Paris 11' , ..... 'Paris 19' , 'Paris 20'

if not I'll sort the results after selection... :-(((

thanks for your lights

joss


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 09:48 AM
strawberry
 
Posts: n/a
Default Re: sorting alphanum colum ..


Josselin wrote:

> happy visitors of Paris know about the 'arrondissement', an
> administrative division of the city... 20
> selecting them from a city database brings them as
>
> 'Paris 1' , 'Paris 10' , 'Paris 11' , ..... 'Paris 19' , 'Paris 2' ,
> 'Paris 20' , 'Paris 3' , .... 'Paris 9'
>
> is there any way to get them ordered as :
> 'Paris 1' , 'Paris 2' , 'Paris 3' , .... 'Paris 9' , 'Paris 10' ,
> 'Paris 11' , ..... 'Paris 19' , 'Paris 20'
>
> if not I'll sort the results after selection... :-(((
>
> thanks for your lights
>
> joss


Remove 'Paris' from the arrondissement field

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 09:48 AM
Good Man
 
Posts: n/a
Default Re: sorting alphanum colum ..

"strawberry" <zac.carey@gmail.com> wrote in news:1166629014.665983.254180
@i12g2000cwa.googlegroups.com:

>
> Josselin wrote:
>
>> happy visitors of Paris know about the 'arrondissement', an
>> administrative division of the city... 20
>> selecting them from a city database brings them as
>>
>> 'Paris 1' , 'Paris 10' , 'Paris 11' , ..... 'Paris 19' , 'Paris 2' ,
>> 'Paris 20' , 'Paris 3' , .... 'Paris 9'
>>
>> is there any way to get them ordered as :
>> 'Paris 1' , 'Paris 2' , 'Paris 3' , .... 'Paris 9' , 'Paris 10' ,
>> 'Paris 11' , ..... 'Paris 19' , 'Paris 20'
>>
>> if not I'll sort the results after selection... :-(((
>>
>> thanks for your lights
>>
>> joss

>
> Remove 'Paris' from the arrondissement field


and make the arrondissement field a numeric field (unsigned 'mediumint'
will probably do)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-28-2008, 09:48 AM
Michael Austin
 
Posts: n/a
Default Re: sorting alphanum colum ..

Good Man wrote:

> "strawberry" <zac.carey@gmail.com> wrote in news:1166629014.665983.254180
> @i12g2000cwa.googlegroups.com:
>
>
>>Josselin wrote:
>>
>>
>>>happy visitors of Paris know about the 'arrondissement', an
>>>administrative division of the city... 20
>>>selecting them from a city database brings them as
>>>
>>>'Paris 1' , 'Paris 10' , 'Paris 11' , ..... 'Paris 19' , 'Paris 2' ,
>>>'Paris 20' , 'Paris 3' , .... 'Paris 9'
>>>
>>>is there any way to get them ordered as :
>>>'Paris 1' , 'Paris 2' , 'Paris 3' , .... 'Paris 9' , 'Paris 10' ,
>>>'Paris 11' , ..... 'Paris 19' , 'Paris 20'
>>>
>>>if not I'll sort the results after selection... :-(((
>>>
>>>thanks for your lights
>>>
>>>joss

>>
>>Remove 'Paris' from the arrondissement field

>
>
> and make the arrondissement field a numeric field (unsigned 'mediumint'
> will probably do)


or modify your data 'Paris 1', 'Paris 11' or 'Paris 001', 'Paris 011', Paris 100'

--
Michael Austin.
Database Consultant
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-28-2008, 09:48 AM
Josselin
 
Posts: n/a
Default Re: sorting alphanum colum ..

On 2006-12-20 16:36:54 +0100, "strawberry" <zac.carey@gmail.com> said:

>
> Josselin wrote:
>
>> happy visitors of Paris know about the 'arrondissement', an
>> administrative division of the city... 20
>> selecting them from a city database brings them as
>>
>> 'Paris 1' , 'Paris 10' , 'Paris 11' , ..... 'Paris 19' , 'Paris 2' ,
>> 'Paris 20' , 'Paris 3' , .... 'Paris 9'
>>
>> is there any way to get them ordered as :
>> 'Paris 1' , 'Paris 2' , 'Paris 3' , .... 'Paris 9' , 'Paris 10' ,
>> 'Paris 11' , ..... 'Paris 19' , 'Paris 20'
>>
>> if not I'll sort the results after selection... :-(((
>>
>> thanks for your lights
>>
>> joss

>
> Remove 'Paris' from the arrondissement field


thanks fya but over 40'000 cities in the table only 3 have
arrondissements (Paris -> 20, Marseille -> 16 and Lyon -> 9)
which is a very very low percentage...
I assume thet tah solution is sorting raw SQL output in an array , Ruby
can do that easily...

joss

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:11 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com