MySQL: return “0” & “1” rather than “false” & “true”

前端 未结 4 998
抹茶落季
抹茶落季 2021-01-20 10:54

I need to return true or false rather than 1 & 0, using following query:

select if(u.id is null,false         


        
4条回答
  •  时光说笑
    2021-01-20 11:25

    If you want, you can return the values as strings:

    SELECT IF(u.id IS NULL, 'false', 'true') as status
    FROM user u
    LIMIT 10
    

提交回复
热议问题