我有一个查询,需要对其他 2 列为真的列进行计数。当 'DealerName' like '%MINI%' AND 'DealerContact_Y' = 1 时,我需要计算 'DealerName'
但我不确定语法。此查询产生错误
SELECT DealerName,
count(DealerShipId) as dealersContacted,
CASE WHEN
DealerName LIKE "%MINI%", WHEN DealerContact_Y = 1
THEN Count(DealerContact_Y) END as Mini_contacted_yes,
Campaign,
DealerId
FROM tblsummaryResults
有没有办法在 case 语句中做多个 WHENS?