Reputation: 600
table2(sum(col_claim)=50)
table3(sum(col_release)=75)
select total_claim-total_release;
Result = (100+50) - (75+25) = 50
Upvotes: 0
Views: 137
Reputation: 522741
Just inline the subqueries and do the arithmetic:
SELECT
(SELECT SUM(col_claim) FROM table1) +
(SELECT SUM(col_claim) FROM table2) -
(SELECT SUM(col_release) FROM table3) -
(SELECT SUM(col_release_two) FROM table4) AS result;
Upvotes: 1