I have this problem. A column in MySQL DB has data as following: 1 10 100 102 1020 1022 1023 1024 1025 1025A 1026A . . .
I Obtained correct numeric sorting with a query like this:
SELECT DISTINCT LPAD(ubicazione, 8, '0') FROM t_ubicazione ORDER BY LPAD(ubicazione, 8, '0') ASC;
that give me this result:
00000001 00000017 00000018 00000019 0000001A 0000001B 0000001M 0000001S 00000021 00000022
My problem is that 0000001A should be after 00000001, so correct order should be:
00000001
0000001A
0000001B
0000001M
0000001S
00000017
00000018
00000019
00000021
00000022
how can I obtain this result?