I want sum of two column values from two different tables, how can I do it using SQL?
Suppose, these are my two tables, Table 1
Id amount date
101 100 2018-09-03
102 200 2018-09-03
Table 2
ID amount Date
101 500 2018-09-03
I want the result as
ID amount
101 600
Answered by:- jaya
Suppose, you have two tables as shown below

Then you can execute the SQL query as below to get the total Amount of each row
select Id,sum(Amount) total
from
(
select Id,Amount
from TestTable1
union all
select Id,Amount
from TestTable2
) t
group by Id
Output:

Note: You will need to update column names / table names, as per your database table name and column name.
It should work.
Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly