I am having a difficulty in summing and updating those row amount to one row of the same receiving column.
please can someone help me. here is the image.
I am having a difficulty in summing and updating those row amount to one row of the same receiving column.
please can someone help me. here is the image.
If I understand your requirement, you want to delete all records from the original table, leaving only one per receiver. And you want to update the amount for that remaining record to the sum of amounts for all records, for that receiver. Rather than trying to deal with a complex update and delete operation, I might recommend that you just create a new table and insert the data you want into that:
CREATE TABLE new_table (receiver varchar(11), amount int); INSERT INTO new_table (receiver, amount) SELECT receiver, SUM(amount) FROM original_table GROUP BY receiver Then, you can drop the original table since you don't need/want it anymore.
Try this
SELECT receiver, SUM(amount) as total FROM table GROUP BY receiver This will add all amount with the same receiver