I want a column where I count transactions where itemtype contains either one of two specified values or location contains one of two specified values. The first two columns (itemtype and location) gives correct figures, but the third seems to count all transactions, irrespective of itemtype or location. What am I doing wrong?
SELECT
COUNT(CASE WHEN itemtype IN ('BARNTAL','STORSTIL') THEN 1 END) 'itemtype',
COUNT(CASE WHEN location IN ('Lattlast','Appelhyllan') THEN 1 END) 'location',
COUNT(CASE WHEN itemtype IN ('BARNTAL','STORSTIL') THEN 1
WHEN location IN ('Lattlast','Appelhyllan') THEN 1
ELSE 0
END) 'total'
FROM statistics