Hello MySQL Gurus,

I have a simple query question.

For the sake of simplicity, let's imagine this is my table of results.

user_id amount
1 20
1 24
2 32
3 55

When I output this data using a while or foreach loop, how can I merge the rows that have the same user_id and also add it's amount to one value. So it displays something like this:

1 Total amount: 44
2 Total amount: 24
3 Total amount: 55

Thank you