查询语句:将 0,1 字段,换成 男,女

来源:互联网 发布:程序员具体有什么岗位 编辑:程序博客网 时间:2024/06/09 17:24

查询语句:将 0,1 字段,换成 男,女

select  case 列名

           when   0  then ‘男’

            else ‘女’ end

  as 要显示列名

from 表名

where 条件

例如: select case sex when 0 then '男' else '女' end as '性别' from student 

原创粉丝点击