Hi, I'm getting 'Divide By Zero' error inside this sql,
Caused by having some rows with DRQNTD=0. I'd try the IIf() construction, but since it is in Group By clause, it won't let me use it.
SELECT DRRUB, '' AS [Desc], Sum(DRVAL) AS Value, Sum(DRQNTD) AS Qty, Sum(DRVAL)/Sum(DRQNTD) AS UnitPrice INTO tblResult
FROM DRTIT
GROUP BY DRRUB, '', DRCOD
HAVING DRCOD='00764394';
Have any of you a work around for this?
Tkx in advance,
Carlos Paiva
Caused by having some rows with DRQNTD=0. I'd try the IIf() construction, but since it is in Group By clause, it won't let me use it.
SELECT DRRUB, '' AS [Desc], Sum(DRVAL) AS Value, Sum(DRQNTD) AS Qty, Sum(DRVAL)/Sum(DRQNTD) AS UnitPrice INTO tblResult
FROM DRTIT
GROUP BY DRRUB, '', DRCOD
HAVING DRCOD='00764394';
Have any of you a work around for this?
Tkx in advance,
Carlos Paiva