I have 2 tables. Both the tables contain 2 columns: id, amt.
Table 1 has these data:
id, amt
1, 500;
2, 2000;
4, 1000.
Table 2 contains:
id, amt
1, 100;
1, 100;
1, 100;
1, 100;
1, 100;
2, 250;
3, 300;
4, 1000;
Now my requirement is getting the record which is common id and common amt in both the table. But the challenge here is, id 1 is available in both the table. But the sum(amt) in table 2 with id 1 = amt in table 1 with id 1. I need to pull this record also as a common record. Please help me in this. Thanks.
Something like: