Lynn Emery

Lynn Emery

  • NA
  • 47
  • 56.5k

Divide By zero Error

Mar 5 2013 4:53 AM
Hi i am trying to do the following calculation but I get an error satating 'divide by error encountered'

SELECT        Customer1, QtyRefunded, Year, Month, QtySales, CAST(SUM(QtyRefunded) * 1000000 / SUM(QtySales) AS DECIMAL(9, 2)) AS PPM
FROM            dbo.[Refunds&ShippedJoin]
GROUP BY Customer1, QtyRefunded, Year, Month, QtySales

I pressume it is becuase I am dividing a number by 0, however I don't know how to ressolve this error.
Thank you for your help in advance.

Answers (1)