天天看点

数据库查询字段为空时,返回0

oracle

select nvl(字段名,0) from 表名;

sqlserver

select isnull(字段名,0) from 表名;

mysql

select ifnull(字段名,0) from 表名;

postgresql

select coalesce(字段名,0) from 表名;