mysql查询替换语句

来源:互联网 发布:软件培训会议纪要 编辑:程序博客网 时间:2024/05/20 05:56

字段:thing_id,recive_pho,send_id,yanzhen_id,box_id,state;

我需要在查询的时候将box_id,state的值替换为用户可以理解的字符,方法如下:

select thing_id,recive_pho,send_id,yanzhen_id,case box_id when 1 then '大' when 2 then '中' else '小' end as box_id,case state when 1 then '有' else '无' end as state from thing;

0 0
原创粉丝点击