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

前端 未结 4 999
抹茶落季
抹茶落季 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:21

    IF()

    You are missing single quotes.

    select if(u.id is null,'false','true') status
    from user u
    limit 10;
    

提交回复
热议问题