当我尝试对列进行平均处理然后我想对结果求和时遇到了麻烦,我正在使用 MYSQL 来做到这一点。谁能帮我?这是不起作用的查询:
SUM(IF(AVG(Value)=3,1,0)) AS green
完整查询:
SELECT
cluster,
SUM(IF(AVG(Value) AS Value = 3,1,0)) AS green
FROM network
WHERE date>= '2012-07-01'
AND date<= '2012-07-02'
AND Region = 'SOMEREG'
AND cluster IS NOT NULL
GROUP BY cluster