List:General Discussion« Previous MessageNext Message »
From:John Kopanas Date:April 7 2007 6:19pm
Subject:How can I do something like this in mySQL...
View as plain text  
I have a query that looks something like this:

SELECT (c_o_w_inst_rev - c_o_w_estcost)/c_o_w_inst_rev
FROM tmpGovernmentSummaries

The problem is that sometimes c_o_w_inst_rev is 0 and dividing by zero
returns a NULL.

If c_o_w_inst_rev == 0 how can I return 0 for the SELECT above instead
of NULL?  Can I test in the SELECT if c_o_w_inst_rev is 0 and return 0
and if not do the math?

Insight would be greatly appreciated :-)


-- 
John Kopanas
john@stripped

http://www.kopanas.com
http://www.cusec.net
http://www.soen.info
Thread
How can I do something like this in mySQL...John Kopanas7 Apr
  • Re: How can I do something like this in mySQL...John Meyer7 Apr
  • Re: How can I do something like this in mySQL...Mogens Melander8 Apr
    • Re: How can I do something like this in mySQL...John Kopanas8 Apr