我们经常会遇到这种情况,数据库里面是Null值,但是显示出来的内容可能是其他内容,这种情况怎么写sql呢?
有2种,一种用自带的函数,一种用case语句。
select coalesce(comm,0) from emp
select case when comm is null then 0
else comm
end
from emp
我们经常会遇到这种情况,数据库里面是Null值,但是显示出来的内容可能是其他内容,这种情况怎么写sql呢?
有2种,一种用自带的函数,一种用case语句。
select coalesce(comm,0) from emp
select case when comm is null then 0
else comm
end
from emp