Answer the question
In order to leave comments, you need to log in
How to use CASE to modify a table?
My code for this is:
cur.execute(f"""SELECT id_(
CASE
WHEN id_ > 0 THEN UPDATE Home_work SET {For_lesons[Iug]} = '{CVB}'
ELSE INSERT INTO Home_work(Алгебра, Геометрия, Физ_ра, Укр_м, Укр_літ, Русск_яз, Русск_лит, Изо, Нем_яз, География, Англ_яз, Биология, Информатика, Физика, Основы_здоровья, Химия, Музыка, Ист_укр, Всем_ист, Труды_для_м, Труды_для_д) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?), {G})
END,
FROM Home_work)""")
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question