2

I need to order a queries results by the name which is a varchar(50) from the bundles table. The table contains the following values for name:

# 'Package 1', 'Package 2', 'Package 3', 'Package 10' etc.
SELECT name FROM bundles ORDER BY name ASC;

This query returns the following order:

Package 1
Package 10
Package 11
Package 2
Package 3
etc...

Is there anyway with mysql to make it order naturally:

Package 1
Package 2
Package 3
...
Package 10

or is this something i will have to code manually with the results.

I have tried:

ORDER BY ABS(name)
and
ORDER BY (name+0)

on suggestions found around the web, neither work.

Rob
  • 7,039
  • 4
  • 44
  • 75

0 Answers0