ms访问具有计数语法错误

时间:2015-02-27 00:29:17

标签: ms-access count having

SELECT hhid, 

COUNT(kind) AS h_spray

FROM pest

WHERE kind="h"
having count(spray) =0

GROUP BY hhid;

我想看到的输出是根据其种类喷洒的农药数量,但如果品牌为0,则不应计算

1 个答案:

答案 0 :(得分:0)

下面的代码将提供计数大于1的喷雾计数。

SELECT hhid, COUNT(kind) AS h_spray
FROM pest
WHERE kind="h" 
GROUP BY hhid
having count(spray) > 0;