使用case when end时,then后面不能使用双引号,需要使用单引号
如:
select count(*) as "违法次数",
case
when fc.dmsm1 like '%货车%' then '货车'
when fc.dmsm1 like '%客车%' then '客车'
when fc.dmsm1 like '%轿车%' then '轿车'
when fc.dmsm1 like '%面包车%' then '面包车'
else '其他'
from frm_code fc,vehicle ve
where fc.dmz=ve.cllx
and exists(select 1 from vio_violation vv where vv.hphm=ve.hphm)
group by fc.dmsm1