case
when upper(a.camp_name) like "%Event%" and (upper(a.camp_name) not like "%Event-WBR%" or upper(a.camp_name) not like "%Event-Webinar%") THEN "Field"
else "Demand"
end as Tactic
所需的输出:
Event-WBR = Demand
Event = Field
实际输出:
Event-WBR = Field
Event = Field
尝试一下
case
when a.camp_name like '%Event'
then 'Field'
when ((a.camp_name) like '%Event-WBR' or (a.camp_name) like '%Event-Webinar')
then 'Demand'
end as Tactic
您也可以尝试以下方法
case
when (a.camp_name) = 'Event'
then 'Field'
when (a.camp_name) in ('Event-WBR', 'Event-Webinar')
then 'Demand'
end as Tactic