RE: Sorting UK Postcodes (WAS Sorting Results)

2002-12-12 Thread Alliax
Sorting by number is not important, it was more a general question about sequences of "variousnameXXX" and how to order them correctly with a simple query. Splitting in 2 fields seems the only way then. For the postcode it's just to provide the user with an easy lookup table, but it's not *that* im

RE: Sorting UK Postcodes (WAS Sorting Results)

2002-12-12 Thread Alliax
Hi, yes, that would do, except that I don't know how many letters are in front of the numbers. And since they're not the same letters perhaps ORDER by 1,2 would have done it perfectly, if only we could substring() intelligently first. Cheers, Damien COLA > -Message d'origine- > SQL: > sel

RE: Sorting UK Postcodes (WAS Sorting Results)

2002-12-12 Thread Alliax
Thank you and Yes, separating the postcodes into field letters and numbers may be the only way to be able to order a sequence like that: CV1,CV2,..,CV10,.. It would also work since there could as many letters as needed Anyone has a simple query for odering sequences correctly ? Cheers, Damien COL

RE: Sorting UK Postcodes (WAS Sorting Results)

2002-12-12 Thread Mark Goodge
At 22:53 12/12/2002 +0100, Alliax wrote: Sorry, I forgot to say that postcode can be one or 2 letters in front of the numbers. > -Message d'origine- > They can be E1,E2,..,E12,E13 > Order by name would do: > E1,E10,E11,E12,E13,E2,E3,E4,... > how can I get with a simple ORDER BY query > E1

RE: Sorting UK Postcodes (WAS Sorting Results)

2002-12-12 Thread Chris Stark
PM To: MySQL List Subject: RE: Sorting UK Postcodes (WAS Sorting Results) Sorry, I forgot to say that postcode can be one or 2 letters in front of the numbers. > -Message d'origine- > They can be E1,E2,..,E12,E13 > Order by name would do: > E1,E10,E11,E12,E13,E2,E3,E4,..

Re: Sorting UK Postcodes (WAS Sorting Results)

2002-12-12 Thread Doug Durham
Damien -- What about: select substring(code, 1, 1) as letter, substring(code, 2, 2) + 0 as number from epost order by 2 +++ | letter | number | +++ | E | 1 | | E | 2 | | E | 3 | | E | 4 | | E | 10 | | E

RE: Sorting UK Postcodes (WAS Sorting Results)

2002-12-12 Thread Alliax
Sorry, I forgot to say that postcode can be one or 2 letters in front of the numbers. > -Message d'origine- > They can be E1,E2,..,E12,E13 > Order by name would do: > E1,E10,E11,E12,E13,E2,E3,E4,... > how can I get with a simple ORDER BY query > E1,E2,E3,E4,E5,... ? -