Naturally sorting rows by a column of zero-padded numeric values with MySQL/PHP
I'm trying to naturally sort my database rows by l value.
$sql = "
SELECT DISTINCT l, item, l, s
FROM tr
WHERE s = '" . $_POST['size'] . "'
AND type = '" . $type . "'
ORDER BY l ASC
";
I get database rows in this order: 10, 12, 13, 21, 06, 02, 08
I need this order: 02, 06, 08, 10, 12, 13, 21
ORDER BY field ASC doesn't work as needed. I tried to remove zeros and then sort the array, but that didn't work. Any thoughts?