kingjely
asked on
Mysql if a sum is null make it 0.00
Hi guys, how do i get this string to return 0.00 if it is null
I sum(h.unitsell * h.quantity - h.bulkdiscount,0.00) as YTD,
Thankyou
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
champion
Tanks!
Tanks!
or try doing
SELECT IFNULL(0.00,sum(h.unitsell * h.quantity - h.bulkdiscount)) AS YTD FROM <tablename>
SELECT IFNULL(0.00,sum(h.unitsell
ASKER
Hey sorry kill max i was already done!
SOrry mate, thanks anyways =D
SOrry mate, thanks anyways =D
select
case isnull( sum(h.unitsell * h.quantity - h.bulkdiscount,0.00) )
when 0 then sum(h.unitsell * h.quantity - h.bulkdiscount,0.00)
when 1 then 0.00
end case
case isnull( sum(h.unitsell * h.quantity - h.bulkdiscount,0.00) )
when 0 then sum(h.unitsell * h.quantity - h.bulkdiscount,0.00)
when 1 then 0.00
end case
SELECT IFNULL(0.00,h.unitsell * h.quantity - h.bulkdiscount) AS YTD FROM <tablename>