I have a table with a column 'tag' that contains numbers and letters, such as:
1
2
3
4a
4b
10
11
12
20
Z1
When I run the following query, I don't get the desired order:
SELECT * FROM `items` ORDER BY `tag` ASC;
This would output as (1, 11, 12, 2, 20, 4a, 4b, P1)
I then found a somewhat good workaround by using either "+ 0" or "* 1" in my query:
SELECT * FROM `items` ORDER BY `tag` + 0 ASC;
This would output as (Z1, 1, 2, 3, 4b, 4a, 10, 11, 12, 20), which is only slightly better
Is there any way to ORDER the values so they appear as:
(1, 2, 3, 4a, 4b, 10, 11, 12, 20, Z1)
I would like to avoid adding an order column, because I have 30,000 items and the tags are only subsets of larger categories.