0

enter image description here

using this table, and I want to make the sql result is:

  • name total score
  • SAM 245
  • MARY 120
  • JOHN 205
Ch Sunrain
  • 21
  • 6
  • Does this answer your question? [How to use count and group by at the same select statement](https://stackoverflow.com/questions/2722408/how-to-use-count-and-group-by-at-the-same-select-statement) – ggordon Oct 08 '21 at 01:42
  • sorry, I updated a new example – Ch Sunrain Oct 08 '21 at 01:50

1 Answers1

1

use group and sum

select name, sum(score) as total
from table
group by name
YuTing
  • 6,555
  • 2
  • 6
  • 16
  • While this code may answer the question, providing additional context regarding how and/or why it solves the problem would improve the answer's long-term value. You can find more information on how to write good answers in the help center: https://stackoverflow.com/help/how-to-answer . Good luck – nima Oct 08 '21 at 11:36