Accounts table has 4 records entered in July 2016. Accounts ID Entry date Orignal_Debt A100 15/7/16 $20 A101 22/7/16 $25 A102 25/7/16 $10 A103 28/7/16 $5 Payment table Paid ID Paid date Paid A100 17/7/16 $22 A100 17/7/16 -$22 A100 19/7/16 $20 A101 4/8/16 $30 A102 31/7/16 $2 A102 1/8/16 $2 A102 2/8/16 $2 A102 3/8/16 $2 A102 4/8/16 $2 A102 5/8/16 $2 A103 1/9/16 $5 A103 2/9/16 $10 A103 2/9/16 -$10 Final Output: Output Paid Month Paid Month Paid Month Month-Year Accounts Entered Original Debt Jul-16 Aug-16 Sep-16 Total Paid Jul-16 4 $60 $22 $33 $5 $60 Some points to be noted: 1. From the payments table, we can see that A101 has paid 5$ extra that does not need to be considered. 2. A102 has done payment in installments but mistakenly paid 2$ extra that does not need to be considered. 3. For ID A100 and A103, there were some records that were mistakenly recorded that has to be avoided (reversal of values). Any help would be appreciated.
... View more