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

Come convertire bool in int in MySql

Typecasting da booleano a intero:

SELECT CAST(1=1 AS SIGNED INTEGER); /* 1 */

Lo stesso per decimale e stringhe:

SELECT CAST("1.23" AS SIGNED INTEGER); /* 1 */