首先: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