我有两个查询与union All
.
SELECT select 'Finished' AS Status,amount AS amount,units As Date
from table1 WHERE Pdate > cdate AND name =@name
UNION ALL
SELECT select 'Live' AS Live,amount,units
from table1 Where Pdate = cdate And name =@name
结果
Status amount units
Finished 100 20
Live 200 10
当任一查询获取空集时,我只得到一行,如果两者都获取空集,则我没有行
那么我怎样才能得到这样的结果
Status amount Units
Finished 100 20
Live 0 0
或者
Status amount Units
Finished 0 0
Live 200 10
或者
Status amount Units
Finished 0 0
Live 0 0
谢谢。