I have this statement :
SELECT sum(CASE WHEN `Agent Code` LIKE '%GB01%' THEN Premium END ) AS 'Tswane Soweto',
sum(CASE WHEN `Agent Code` LIKE '%WW02%' THEN Premium END ) AS 'North West Moretele',
sum(CASE WHEN `Agent Code` LIKE '%WW02%' THEN Premium END ) AS 'North West Odi',
sum(CASE WHEN `Agent Code` LIKE '%GA01%' THEN Premium END ) AS 'Tswane PTA'
FROM production
but I want to put a where in ('PTA','JHB') intot every case statement. Where do I put it with the above?
thanks
SELECT sum(CASE WHEN `Agent Code` LIKE '%GB01%' THEN Premium END ) AS 'Tswane Soweto',
sum(CASE WHEN `Agent Code` LIKE '%WW02%' THEN Premium END ) AS 'North West Moretele',
sum(CASE WHEN `Agent Code` LIKE '%WW02%' THEN Premium END ) AS 'North West Odi',
sum(CASE WHEN `Agent Code` LIKE '%GA01%' THEN Premium END ) AS 'Tswane PTA'
FROM production
but I want to put a where in ('PTA','JHB') intot every case statement. Where do I put it with the above?
thanks