把SQL查询结果为null值 替换为0
方法1:使用isnull替换
select keyId,isnull(info,0) as info from test
---方法2:使用case when 替换
select keyId,case when info is null then 0 else info end as info from test
---方法3:使用coalesce替换相应的值
select keyId , coalesce(info,0) as info from test
select keyId,isnull(info,0) as info from test
---方法2:使用case when 替换
select keyId,case when info is null then 0 else info end as info from test
---方法3:使用coalesce替换相应的值
select keyId , coalesce(info,0) as info from test
佛说,机遇总是留给有准备的人