How do I sort my database by numbers 0-9?
For example:
2pac 50 cent Chamillionaire Eminem
How would I sort just the values that start with 0-9 (numbers only)?
What you want is called a "natural sort". As far as I know you would have to do the sort in php: http://php.net/natsort
SELECT name FROM mytable WHERE SUBSTRING(name,1,1) IN ('0','1','2','3','4','5','6','7','8','9') ORDER BY name
barand wrote:SELECT name FROM mytable WHERE SUBSTRING(name,1,1) IN ('0','1','2','3','4','5','6','7','8','9') ORDER BY name
This worked thanks a lot!