I'm making a basketball stats database, and have a table in SQL with the player's totals from all of their games combined. I'm having trouble adding to it, however. I use a temporary table for each game, and then I need to add all of the temporary values to the player's total table. How would I do this? I have tried many methods, each of which throw an error. Here are a few:
(live_players is the temporary table, and here I'm only trying to join the points column.)
db.execute("UPDATE players JOIN live_players AS t1 ON players.player_id
= t1.player_id SET points = points + t1.points")
db.execute("MERGE INTO players USING live_players ON players.player_id
= live_players.player_id WHEN MATCHED THEN UPDATE
SET points = points + live_players.points")