i hav a 3 tables
1> id amount 2>id amount 3>Id amount
1 100 1 100 1 100
2 200 2 200 2 200
3 300 3 300
4 400
output> id AMOUNT
1 300
2 600
3 600
4 400
let me know the answer any one? Please share with me

Shubham KumarRank #621 · 3.8K reputationPosted Feb 22, 2016, 8:01 PM EST
ali tuncerRank #1,499 · 1.1K reputationPosted Feb 22, 2016, 8:12 PM EST
you can union tables, group by ID and get sum..
SELECT ID, Sum(Amount)
FROM (select ID,Amount
from Table1
union ALL
select ID,Amount
from Table2
UNION ALL select ID,Amount
from Table3)
GROUP BY ID