I can't understand because this SQL query doesn't work:
SELECT COUNT Department,
IF(Department = 'toys', COUNT(), 0) AS numberOfToys,
IF(Department = 'health', COUNT(), 0) AS numberOfHealth
FROM TABLE;
TABLE
Department - Value
toys - A
toys - B
toys - C
health - K
health - F
toys - G
toys - R
toys - W
toys - Q
I'd like to count number of occurrences about both toys record and health ones into 2 columns.
department numberOfToys numberOfHealth
toys 7 0
health 0 2
WHY ?!
thanks