Subject | "divison by 0" question |
---|---|
Author | Eugen Stoianovici |
Post date | 2007-05-10T09:24:39Z |
I have a query that looks something like:
SELECT
S.PRICE SALEPRICE,
E.PRICE ENTRYPRICE,
(S.PRICE -I.PRICE)/I.PRICE PERCENT
FROM SALES S, ENTRYS E
WHERE S.IDENTRY = E.ID
The problem is that I.PRICE can be 0 and i get a division by 0 error. Is
there a way to make PERCENT = 100 if I.PRICE = 0 without running two querys?
SELECT
S.PRICE SALEPRICE,
E.PRICE ENTRYPRICE,
(S.PRICE -I.PRICE)/I.PRICE PERCENT
FROM SALES S, ENTRYS E
WHERE S.IDENTRY = E.ID
The problem is that I.PRICE can be 0 and i get a division by 0 error. Is
there a way to make PERCENT = 100 if I.PRICE = 0 without running two querys?