当前位置:首页 > 开发 > 数据库 > 正文

MySql中case when then 的使用

发表于: 2015-07-19   作者:fanxiaolong   来源:转载   浏览:
摘要: select "主键", "项目编号", "项目名称","项目创建时间", "项目状态","部门名称","创建人" union (select pp.id as "主键", pp.project_number as &
select "主键",  "项目编号", "项目名称","项目创建时间", "项目状态","部门名称","创建人"

union

(select
	pp.id as "主键",
	pp.project_number as "项目编号",  
	pp.name as "项目名称",
	pp.create_time as "项目创建时间",
	
	CASE WHEN pp.status = 'N' THEN '新建'
	WHEN pp.status = 'T' THEN '提测'
	WHEN pp.status = 'W' THEN '审核通过'
	WHEN pp.status = 'QAS' THEN '等待上线'
	WHEN pp.status = 'H' then '进行中'
	END as "项目状态",

	ppd.name as "部门名称",
	pu.login_name as "创建人"
from pmp_project pp
left join pmp_user pu on pp.create_user_id = pu.id
left join pmp_project_dept ppd on pp.project_line_id = ppd.id 
where pp.status != 'C'
order by s.id)

 

MySql中case when then 的使用

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号