mysql操做case when then else end用法

1,舉例:select full_name '房源名稱',CN '合同編號',contract_starttime '開始時間',contract_endtime '結束時間',salement_id '管房人', `owner_id` '業主' ,case contract_status when 5 then '執行中' when 88 then '已結束' else '其餘' end from table where contract_endtime>='2018-01-01';cdn


2,select fields, case when CreateTime>'2016-02-14 16:24:42' then 'after' when CreateTime<'2016-02-14 16:24:42' then 'before' else 'now' end stage from table order by field DESC;blog

相關文章
相關標籤/搜索