sql 如下
- SQL code
select(case when t.C810000005 when '查询' then t.C800010007 when '专题' then t.C800010009 when '资源' then t.C800010016 else 0 end) as 反馈次数 from aaa
------解决方案--------------------
select case when t.C810000005 = '查询' then t.C800010007
when t.C810000005 = '专题' then t.C800010009
when t.C810000005 = '资源' then t.C800010016
else 0 end as 反馈次数
from aaa
------解决方案--------------------
前面多写了一个when,case t.C810000005
- SQL code
select(case t.C810000005 when '查询' then t.C800010007 when '专题' then t.C800010009 when '资源' then t.C800010016 else 0 end) as 反馈次数 from aaa