The value of adding two fields of MySQL

q:

in mysql, I want to add two fields. The SQL statement is as follows :

select c1 + c2 from table where Id = 1

now there is a problem, when the value of any field c1 or c2 is null, then the result of the addition is null, how to solve this problem?

a:
Select IFNULL(c1,0) + IFNULL(c2,0) from table where Id = 1

or use case when

Read More: