select (SUM(a.IncomeCount)-SUM(b.ExpenditureCount))as balance from a,b
我这样写,为什么结果不对,怎么写
------解决方案--------------------
- SQL code
select (select sum(IncomeCount) from a)+(select sum(ExpenditureCount) from b)as balance
------解决方案--------------------
a和b 的关联条件忘记写了。