sql中case when写法

来源:互联网 发布:js定义二维数组举证 编辑:程序博客网 时间:2024/05/23 01:24

<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">如果需要转换查出值的显示可以使用case when 如:</span>
<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);"></span><pre name="code" class="sql">select id,case state when 1 then '暂存' when 2 then '提交'  else '其他' end from t_t_table 

或者使用
select id, state=( case fstate when 1 then '暂存' when 2 then '提交'  else '其他' end ) from t_t_table 

0 0
原创粉丝点击