case when用法。。

case when 转自:http://www.cnblogs.com/zhyue93/p/sql2008.html

1
2
3
4
5
6
7
8
9
10
11
12
select a.ApplyID,convert(nvarchar(20),a.TripTime,101) as TripTime,a.[Target],a.ApplyerNum,a.ApplyerName,
case a.CheckState when then '待审核'
                  when then '审核通过'
                  when then '退回'
                  else '' end as CheckState,
case a.AssignState when then '待分派'
                   when then '已分派'
                   else '-' end as AssignState,
case a.DriverState when then '退回'
                   when then '已确认'
                   else '-' end as DriverState
from cmApply a
posted @ 2016-08-30 14:57  wszlsc  阅读(174)  评论(0)    收藏  举报