Sort VARCHAR as INT in MySQL

Sometimes we can user VARCHAR for integer values. But when we need sort them, we have got big problem. Because VARCHAR’s are string and it is sorting like a string. Example: 1a 2a 3a 10b 20b 30b 15c 25c 35c (VARCHAR) 1a 10b 15c 2a 20b 25c 3a 30b 35c (Sorted) We need 1a 2a …

Continue reading