MySQL算术减法

时间:2017-05-13 19:51:01

标签: mysql subtraction

我有一张这样的表:

MYSQL 
table_01            tablo_02

Calculated tax      Deductible tax
--------------      ---------------
1200                2100
2305                5200
3250                1200    
2501                3215

我想要这样的结果

total table_01 - total table_02 = result

1 个答案:

答案 0 :(得分:0)

这样的事情:

select (
        select sum(calculated_tax)
        from table_01
        ) - (
        select sum(deductible_tax)
        from table_02
        ) as result