Reputation: 5550
Select sum(amt) as totalA from tableA where id>10;
Select sum(amount) as totalB from tableB where people = 'JOSH';
What is the best way if the objective is to have sum(totalA + totalB)
?
Upvotes: 0
Views: 1870
Reputation: 24146
select sum(total) from
(
select sum(amt) as total from tableA where id>10
union all
select sum(amount) from tableB where people = 'JOSH'
) as q
Upvotes: 2