我的查询是:
Select sum (node.weight * ans.cn_age) / sum (node.weight) as sum_weight , poll.pollName as poll , poll.endDate as date
From report.cm_job_satisfaction ans
Join poll_management.POLLES poll on ans.cn_pollid = poll.id
Join poll_management.POSITIONS node on ans.cn_positionid = node.id
Group by poll , date
Order by date
但我有错误:
ERROR: division by zero
********** Error **********
ERROR: division by zero
SQL state: 22012
我知道因为某些node.weight是0然而如何解决这个问题?