直接出来:
select (select sum(isnull(c,0)) from a) - (select sum(isnull(c,0)) from b)
用视图:
create view c as select sum(isnull(c,0)) as e from a
create view d as select sum(isnull(c,0)) as f from b
第三个视图select b.e-c.f from a,b这样做是不对的。
应为:
select c.e - d.f from c, d