#1064 - 您的SQL语法出错;检查与MySQL服务器版本对应的手册,以便在第2行) AS county FROM q_mem_tim
附近使用正确的语法
SELECT Count( * ) AS m,
SUM(CASE
WHEN y = '2011' THEN 1
ELSE 0 ) AS county
FROM q_mem_tim
我的代码出了什么问题?
答案 0 :(得分:5)
使用:
SELECT COUNT(*) AS m,
SUM(CASE
WHEN y = '2011' THEN 1
ELSE 0
END) AS county
FROM q_mem_tim
CASE
语句需要END
关键字来指示它何时结束。