Update table with SUM from another table

前端 未结 1 913
北荒
北荒 2020-12-18 23:50

I am trying to what I thought was going to be a simple update of a table with the sum from another table, but for some reason, it is only updating one row. Here is what the

相关标签:
1条回答
  • 2020-12-19 00:13
    UPDATE playercareer c
    INNER JOIN (
      SELECT gameplayer, SUM(points) as total
      FROM games
      GROUP BY gameplayer
    ) x ON c.playercareername = x.gameplayer
    SET c.playercareerpoints = x.total
    
    0 讨论(0)
提交回复
热议问题