How do I order by in mysql when the value are alpha numeric?

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.

Answers


See Natural Sort in MySQL


Need Your Help

CScript/WScript Prevent an error from being blocking

vbscript automation wscript

Currently, WScript pops up message box when there is a script error. These scripts are called by other processes, and are ran on a server, so there is nobody to dismiss the error box.

Install Visual studio 2013 Error in Windows 7

.net visual-studio visual-studio-2012 visual-studio-2013

I am trying to install visual studio 2013 express in Windows 7(Home premium) Laptop and it gives me the following error message and don't let me install this.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.