Mysql
 sql >> Database >  >> RDS >> Mysql

MySQL ordina per stringa con numeri

Puoi usare SUBSTR e CAST AS UNSIGNED/SIGNED in ORDER BY:

SELECT * FROM table_name ORDER BY
    SUBSTR(col_name FROM 1 FOR 1),
    CAST(SUBSTR(col_name FROM 2) AS UNSIGNED)