my query is :
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
but i have error :
ERROR: division by zero
********** Error **********
ERROR: division by zero
SQL state: 22012
I know because some node.weight is 0 however how to fix this ?