Reputation: 703
I have a bunch of products in my database with imaginative names like '256', '167 brown' and '1115 black' I need to return them ordered by product number so that product named 256 would come before 1115 black but after 167 brown. Is there a way to do this?
Upvotes: 2
Views: 1144
Reputation: 57593
Try this:
SELECT code FROM your_table
ORDER BY CAST(code AS SIGNED)
Upvotes: 8