James Smith wrote:
> 
> SELECT col1/col2 AS result
> FROM aTable
> 
> What is the simplest way to make col2 "0.01" if it is 0.
> 

You also could do it with a CASE statement...

SELECT col1/CASE col2 WHEN 0 THEN 0.01 ELSE col2 END AS result

OR

SELECT CASE col2 WHEN 0 THEN -1 ELSE col1/col2 END AS result
(if you really just want some predetermined value in there if col2 is 0)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:262850
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to