MySQL Forums
Forum List  »  Newbie

Re: Adding null values
Posted by: Ramalingam Chelliah
Date: August 23, 2004 09:24PM

Hi,

I think IFNULL() Function will help you do that...

In SELECT Statement where you need the sum of a and b

use this expression ...
IFNULL(a+b,IFNULL(a,b))

If you need 0 for the case where a and b are both null
IFNULL(a+b,IFNULL(a,IFNULL(b,0)))

Refer:
http://dev.mysql.com/doc/mysql/en/Control_flow_functions.html

Hope this helps you....

Regards,
Ram.


We Learn the Most When we have to Invent

Options: ReplyQuote


Subject
Written By
Posted
Re: Adding null values
August 23, 2004 09:24PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.