V
V
Vladislav1052021-01-24 21:32:37
PHP
Vladislav105, 2021-01-24 21:32:37

How to sum rows from the database if the name is the same?

There is a request to mysql to display rows from a table with a rating, where there can be several records for one user.

SELECT name, month, points FROM points WHERE month=? ORDER BY points DESC

If there are several records with the same name, then points must be summed up and the line merge into one.
600dbcce0a7af083006442.png
Fumbled for an hour and a half, I can not make a request. I will be very grateful for your help

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Minister of Defense, 2021-01-24
@Vladislav105

select `name`, `month`, sum(`points`) from `points` group by `name` = ?, `month` = ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question