Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear all,
I have table below, I want to create three more columns in back end only.
1) Net amount ( which will be Sum of Amt_2 and Amt_1)
2) Total amount ( which will be Sum of Amt_2 and Amt_1 year wise )
ID | Name | Address | Amt_1 | Amt_2 | Date |
1 | John | US | 100 | 200 | 1/10/2023 |
1 | John | US | 300 | 2/10/2023 | |
1 | John | US | 400 | 3/10/2023 | |
1 | John | US | 2100 | 200 | 11/11/2023 |
1 | John | US | 300 | 12/11/2023 | |
1 | John | US | 400 | 13/11/2023 | |
1 | John | US | 3100 | 200 | 21/3/2023 |
1 | John | US | 300 | 22/13/2023 | |
1 | John | US | 400 | 23/3/2023 | |
2 | David | UK | 500 | 1200 | 1/10/2023 |
2 | David | UK | 100 | 1300 | 2/10/2023 |
2 | David | UK | 1400 | 3/10/2023 | |
2 | David | UK | 50 | 4/10/2023 | |
2 | David | UK | 500 | 1200 | 11/11/2023 |
2 | David | UK | 100 | 1300 | 12/11/2023 |
2 | David | UK | 1400 | 13/4/2023 | |
2 | David | UK | 50 | 23/4/2023 |
In above data, for year 2023, Net amount for John should display
800 for Oct month
2600 for Nov Month
-2200 for March month
And for David
3250 for Oct
1900 for Nov
1350 for Apr
And last
Total Amount Yearwise for John it should display
2023 3600
and for david
2023 19500
Final table
ID | Name | Address | Amt_1 | Amt_2 | Date | Net Amount | Net_Amt_SUM | Total Amount Yearwise |
1 | John | US | 100 | 200 | 1/10/2023 | 100 | 800 | 3600 |
1 | John | US | 300 | 2/10/2023 | 300 | 800 | 3600 | |
1 | John | US | 400 | 3/10/2023 | 400 | 800 | 3600 | |
1 | John | US | 200 | 2100 | 11/11/2023 | 1900 | 2600 | 3600 |
1 | John | US | 300 | 12/11/2023 | 300 | 2600 | 3600 | |
1 | John | US | 400 | 13/11/2023 | 400 | 2600 | 3600 | |
1 | John | US | 3100 | 200 | 21/3/2023 | -2900 | -2200 | 3600 |
1 | John | US | 300 | 22/3/2023 | 300 | -2200 | 3600 | |
1 | John | US | 400 | 23/3/2023 | 400 | -2200 | 3600 | |
2 | David | UK | 500 | 1200 | 1/10/2023 | 700 | 3250 | 19500 |
2 | David | UK | 100 | 1300 | 2/10/2023 | 1200 | 3250 | 19500 |
2 | David | UK | 1400 | 3/10/2023 | 1400 | 3250 | 19500 | |
2 | David | UK | 50 | 4/10/2023 | -50 | 3250 | 19500 | |
2 | David | UK | 500 | 1200 | 11/11/2023 | 700 | 1900 | 19500 |
2 | David | UK | 100 | 1300 | 12/11/2023 | 1200 | 1900 | 19500 |
2 | David | UK | 1400 | 13/4/2023 | 1400 | 1350 | 19500 | |
2 | David | UK | 50 | 23/4/2023 | -50 | 1350 | 19500 |