我目前正在做这个查询:
SELECT Date_Format(M.Signupdate,"%Y-%m") as YearMonth,
SUM(IF(Count(H.Nr) >= 0,1,0)) ,
SUM(IF(Count(H.Nr) >= 1,1,0)) ,
SUM(IF(Count(H.Nr) >= 2,1,0)) ,
SUM(IF(Count(H.Nr) >= 3,1,0))
FROM people M
INNER JOIN History H ON H.login = M.Login
WHERE
M.Masteraccount = "" AND
M.logincount > 5 AND
DATEDIFF(M.lastlogin,M.Signupdate) >= 3 AND
DATEDIFF(H.EntryDate,M.Signupdate) <= 151
GROUP BY YearMonth ORDER BY YearMonth ;
但是,我不断收到“[Err] 1111 - 组函数的无效使用”错误。如果我删除 SUM,它就可以正常工作。请问有人给我答案吗?