MYSQL how to sum rows with same key, then delete the duplicate rows
- by Bhante-S
What I have:
key  data
1      22
1       5
2       6
3       1
3      -3
What I want:
key  data
1      27
2       6
3      -2
I don’t mind doing this with two or more queries, esp. if they are simple--makes for easier maintenance. Also the tables are fairly small (<2,000 records).  The ‘key’ field is indexed and allows duplicates.
Muchas Gracias