Dedupe rows and add up corresponding integers PHP/MySQL

35 views Asked by At

I have a large MySQL table that includes events as rows. Each row has a description and a corresponding value. The titles are duplicated throughout however and I would like to deduplicate them and sum together their values in PHP.

For example, if I have:

Title 1, 10
Title 1, 20
Title 2, 10
Title 3, 5
Title 3, 20

I would like to end up with:

Title 1, 30
Title 2, 10
Title 3, 25

Help greatly appreciated.

0

There are 0 answers