Forum Moderators: coopster
I've got a MySQL db with varchar field that has product titles like foo1 - foo100. I want to order the products by the number immediately after the 'foo' part of the product name.
At this point I've stripped the 'foo' part off of the string in my ORDER BY clause like so:
ORDER BY SUBSTRING(product,3)
Now I'm been trying to find a function with in MySQL that will let me convert the numeric portion of the sting into an integer so I can sort it. Does it exist? And no, I don't want to have to add another column to sort on. ;)
ORDER BY SUBSTRING(product,3) * 1;
Relative thread:
Outing numbers in Order? [webmasterworld.com]