q: strong> p>
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: strong> p>
Select IFNULL(c1,0) + IFNULL(c2,0) from table where Id = 1
or use case when
Read More:
- Solution to error reporting on the client caused by adding fields on the CXF server
- After the two hosts set up the master-slave replication of MySQL, the show slave status displays: last_ IO_ Error: error connecting to master ……
- New fields in hive table and modification of field comments
- How to Fix Parser rerror: error tokenizing data. C error: expected 2 fields in line 53, saw 3
- How can Oracle query tables of other users without adding a table user name
- (error when importing database): MySQL 2006-mysql server has gone away
- The sum of the two numbers of leetcode
- Encapsulation of adding, deleting and modifying database by JDBC
- MySQL – ERROR 1146 (42S02): Table ‘mysql.user’ doesn’t exist
- MySQL error — multiple methods of failed to find valid data directory and MySQL setting password appear
- MySQL local connection Error 1130_ The solution of MySQL 1130 error report when remote connection through Navicat for MySQL
- MySQL error set: failed to start mysql.service : Unit mysql.service is masked.
- Spring boot thymeleaf crud implements simple functions of adding, deleting, modifying and querying
- QQ browser open automatically appear two web page solution
- Mysql Error:The user specified as a definer (‘mysql.infoschema‘@‘localhost‘) does not exist
- MySQL: if the remote connection using navicatip fails, prompt “is not allowed to connect to this MySQL server”
- Two solutions to Cannot load module file xxx.iml
- Compare whether two sets are the same in Java
- Two ways of fuzzy query in mybatis
- It can’t connect to local MySQL server through socket ‘/ tmp/ mysql.sock ‘(2) “;