Sql怎么把int类型里的0和1显示为完成或未完成数据库字段Status,int类型怎么把Status里的0和1数据显示为完成或未完成
select (case 字段 when 0 then '未完成' when 1 then '完成' end) as 状态 from table
一楼的方案是可以的,可以对于多个类型判断,,如果只0和1两个值,下面的写法也是可以的。
select IF(Status=0,'完成','未完成') AS Status from table