如何将查到的空记录显示为0
sql吧
全部回复
仅看楼主
level 7
这个空是指没有这个数,而不是这个数的值为null,所以nvl函数用不了,希望有大佬给提供一下解决思路
2021年05月08日 07点05分 1
level 3
试试:isnull(字段名,0)
2021年05月08日 09点05分 3
这是sql sever的函数,跟oracle的nvl函数功能一样,没用
2021年05月12日 02点05分
level 8
select first_name,commission_pct from s_emp a where a.first_name='阿伟'
union all
select first_name,nvl(commission_pct,0) from s_emp a where a.first_name='阿伟'
union all
select '',0 from dual where (select count(1) from s_emp a where a.first_name='阿伟')=0
2021年05月12日 02点05分 5
level 7
2021年05月13日 02点05分 6
1