mysql的case when使用

首先:case when的表达式是一个值 html

表order: code

id   payment  status xml

要求输出全部列以及status对应的“中文注释” htm

select t.pay_status,t.create_time,t.prod_total_amt,
			(case t.pay_status
				when 0 then '已支付'
				when 1 then '还未支付'
				when 2 then '部分支付'
				else '其余'
			end) as status_desc
 		from tbl_order_main t limit 100
看一篇不错的文章:

http://www.cnblogs.com/john2000/archive/2010/09/21/1832729.html blog

相关文章
相关标签/搜索