I believe something like this should work https://www.sqlservertutorial.net/sql-server-basics/sql-server-update-join/
Using an inner join. Let me know if you need help. C On Thu, 14 Jan 2021 at 22.52, Philippe Michel <philippe.mich...@free.fr> wrote: > A few weeks ago, someone reported two bugs (#59208 and #59209) in the > way match results are stored in the database. > > I have committed a fix when for new entries, but existing ones have to > be updated directly in the database. The commands below should work for > sqlite3 but I think it should be possible to do this purely in SQL, > without intermediate files (and in a way working as is for mysql or > postgresql) > > Are there readers more familiar with SQL who could suggest better commands > ? > > .output fixgame.sql > .separator "" > select "update game set result = ", -actual_result/abs(actual_result), > "*result where game_id=", game_id, ";" from gamestat where gamestat_id = > 2*game_id; > .output > .read fixgame.sql > > .output fixsession.sql > .separator "" > select "update session set result = ", actual_result/abs(actual_result), " > where session_id=", session_id, " and result = 0;" from matchstat where > matchstat_id = 2*session_id; > .output > .read fixsession.sql > > >