显示空值

时间:2016-10-14 06:57:10

标签: sql oracle

select min(code) as AC 
from Tab1e1 
where id=1 
Union 
select min(code) as AC          
from Table2 
where id=1

我得到的行如下

ac
--
101
null

但我不想要空行。我该怎么办?可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

尝试为每个

添加此条件
and code is not null

select min(code) as AC from Tab1e1 where id=1 and code is not null 
Union 
select min(code) as AC from Table2 where id=1 and code is not null

因为代码值为空