List:General Discussion« Previous MessageNext Message »
From:Ed Reed Date:July 16 2004 6:36pm
Subject:IFNULL returns NULL when it shouldn't
View as plain text  
How do I prevent IFNULL and ISNULL from returning a null?
I have the following query where this is occurring,
Select IFNULL(sum(qty),0)
from inventory
where partnumber=111
group by partnumber;
If the partnumber has never been in inventory then the sum and ifnull
functions both return null. If the partnumber has been in inventory then
the sum returns the correct sum but I need it to return a zero if it's
null. It also doesn't matter if I use the ISNULL funtion or the Is Null
operation with a IF statement.
Any suggestions?

IFNULL returns NULL when it shouldn'tEd Reed16 Jul
  • Re: IFNULL returns NULL when it shouldn'tMartijn Tonies16 Jul