[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SQL question
From: |
Philippe Michel |
Subject: |
SQL question |
Date: |
Thu, 14 Jan 2021 22:51:37 +0100 |
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
- SQL question,
Philippe Michel <=