select a.X - b.Y from (select sum(a.charge) x from table1 a,table2 b, table3 c where ...) a, (select sum(a.charge) y from table1 a,table2 b, table3 c where ...) b;
select sum(a.charge) from table1 a,table2 b, table3 c where ... minus select sum(a.charge) from table1 a,table2 b, table3 c where ...
from (select sum(a.charge) x from table1 a,table2 b, table3 c where ...) a,
(select sum(a.charge) y from table1 a,table2 b, table3 c where ...) b;
minus
select sum(a.charge) from table1 a,table2 b, table3 c where ...
我用过好用
从实现上来说肯定能实现,但是效率不行,尤其是项目
所以我建议你不要使用一个SQL实现