I have a MySQL database table that logs site searches. If it encounters a new search phrase it inserts a new row with the phrase and a counter value of 1. If the phrase already exists it increments the counter.
For example:
Id term count
1 boots 14
2 shirts 2031
3 t-shirt 1005
4 tshirt 188
Unfortunately the table contains duplicates for many phrases, for example:
Id term count
12 sneakers 711
26 sneakers 235
27 sneakers 114
108 sneakers 7
What would a MySQL query look like that combines all the duplicates into one row, totaling up their counts?
What I want:
Id term count
12 sneakers 1067
Thank you in advance.