My Table consists of 3 columns; id, state, carColour, and over 1mil rows. I want to return all states which have more black cars than white cars.
I have tried:
SELECT state
FROM table
WHERE state IN (SELECT state
FROM table
WHERE COUNT(carColour = 'Black') > COUNT(carColour = 'White'))
GROUP BY state
But obviously a count() in a where statement doesnt work... How can I solve this?