Re: [PHP] Natural order of things.

2006-04-27 Thread Robin Vickery
On 27/04/06, tedd [EMAIL PROTECTED] wrote: On Wed, 2006-04-26 at 16:57, Robert Cummings wrote: On Wed, 2006-04-26 at 16:51, tedd wrote: Hi gang: I posted the following question to the MySQL list, but the only answer I received thus far was a php solution (it didn't work for

Re: [PHP] Natural order of things.

2006-04-27 Thread tedd
Never tried it mysql, but I am led to believe that sorting based on the result of the mysql SOUNDEX function may produce the results you want. Other than that, as far as I am aware there is no way to do this in MySQL without writing a stored procedure to do it. -Stut -Stut: Damn, that

[PHP] Natural order of things.

2006-04-26 Thread tedd
Hi gang: I posted the following question to the MySQL list, but the only answer I received thus far was a php solution (it didn't work for what I wanted). As such, maybe if I post a MySQL question to the PHP group, then I'll receive a MySQL answer -- so here goes: I'm using the following

Re: [PHP] Natural order of things.

2006-04-26 Thread Robert Cummings
On Wed, 2006-04-26 at 16:51, tedd wrote: Hi gang: I posted the following question to the MySQL list, but the only answer I received thus far was a php solution (it didn't work for what I wanted). As such, maybe if I post a MySQL question to the PHP group, then I'll receive a MySQL

Re: [PHP] Natural order of things.

2006-04-26 Thread Robert Cummings
On Wed, 2006-04-26 at 16:57, Robert Cummings wrote: On Wed, 2006-04-26 at 16:51, tedd wrote: Hi gang: I posted the following question to the MySQL list, but the only answer I received thus far was a php solution (it didn't work for what I wanted). As such, maybe if I post a

Re: [PHP] Natural order of things.

2006-04-26 Thread Stut
tedd wrote: SELECT id, title, url_image_small FROM $dbtable WHERE type=type_title ORDER BY title LIMIT $offset, $rowsPerPage But, it sorts stuff like this: Basel Square 1 Basel Square 10 Basel Square 11 Basel Square 2 Basel Square 3 Basel Square 4 Basel Square 5 Basel Square 6 Basel Square 7

Re: [PHP] Natural order of things.

2006-04-26 Thread tg-php
You could try separating out the number an formatting it with SQL and doing an ORDER BY on the post-processed number. It doesn't have to appear in the SELECT columns portion to be able to use it in the ORDER BY section. SELECT BookName, PageNum, Citation FROM BookQuotes ORDER BY

Re: [PHP] Natural order of things.

2006-04-26 Thread Richard Lynch
Crude, but effective. ORDER BY length(title) DESC, title You may also need to make it be: ORDER BY substring(title, 1, 10), length(title) DESC, title so you can get them alphabetical to start off with (the first 10 chars) then by the length to hack the longer ones with multiple digits at the

Re: [PHP] Natural order of things.

2006-04-26 Thread tg-php
Going to amend this by saying that whereever the number you need to sort by is located, you should be able to extract it and do the padding trick even if it's in the middle of a string.. as long as the format is regular enough. -TG = = = Original message = = = You could try separating out

Re: [PHP] Natural order of things.

2006-04-26 Thread tedd
On Wed, 2006-04-26 at 16:57, Robert Cummings wrote: On Wed, 2006-04-26 at 16:51, tedd wrote: Hi gang: I posted the following question to the MySQL list, but the only answer I received thus far was a php solution (it didn't work for what I wanted). As such, maybe if I post a MySQL

Re: [PHP] Natural order of things.

2006-04-26 Thread Robert Cummings
On Wed, 2006-04-26 at 21:15, tedd wrote: On Wed, 2006-04-26 at 16:57, Robert Cummings wrote: On Wed, 2006-04-26 at 16:51, tedd wrote: Hi gang: I posted the following question to the MySQL list, but the only answer I received thus far was a php solution (it didn't work for