Reputation: 67
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ) AS county FROM q_mem_tim
at line 2
SELECT Count( * ) AS m,
SUM(CASE
WHEN y = '2011' THEN 1
ELSE 0 ) AS county
FROM q_mem_tim
What is wrong with my code?
Upvotes: 0
Views: 66
Reputation: 332771
Use:
SELECT COUNT(*) AS m,
SUM(CASE
WHEN y = '2011' THEN 1
ELSE 0
END) AS county
FROM q_mem_tim
A CASE
statement requires the END
keyword to indicate when it ends.
Upvotes: 5