This is a discussion on sorting alphanum colum .. within the MySQL Database forums, part of the Database Forums category; happy visitors of Paris know about the 'arrondissement', an administrative division of the city... 20 selecting them from a city ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
"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) |
|
|||
|
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 |
|
|||
|
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 |