I have a varchar field that I need to sort alphanumerically but any letter must sort before all numbers. So any time a letter is sorted against a number anywhere in the string it must come first. So for instance
11B22
must sort before
11122
I have tried this solution: ORDER BY alphabet first then follow by number
Which uses this ORDER BY clause
ORDER BY IF(name RLIKE '^[a-z]', 1, 2), name
It will sort correctly
AAA
before
1AA
but puts
A1A
before
AAA
So it only seems to operate on the first character in the string.