case when语法

来源:百度文库 编辑:神马文学网 时间:2024/04/28 12:29:20
string sql = string.Format("update {0} set IsShopRecommend=(case when Recommend=1 then 0 else 1 end)whereID=@ID and  status={1}", table, Convert.ToInt32(Status.OnAuction--枚举));
CASE
WHEN   CateFolder   IS   NULL   THEN   CurrFolder
WHEN   CurrFolder   IS   NULL   THEN   CateFolder
ELSE   Catefolder   +   '/ '   +   CurrFolder
END
select count(case a.zt when '07' then a.bs end)+
count(case a.zt when '11' then a.bs end)
from dj_zt a
where a.qylx_dm = '03'
select
(case when 语文>=80 then '优秀'
when 语文>=60 then '及格'
else '不及格') as 语文,
(case when 数学>=80 then '优秀'
when 数学>=60 then '及格'
else '不及格') as 数学,
(case when 英语>=80 then '优秀'
when 英语>=60 then '及格'
else '不及格') as 英语,
from table