Answer the question
In order to leave comments, you need to log in
How to update a table one row at a time with a selection of CASE conditions?
I wrote a query to update the `DateClose` field in the `Work` table, which, depending on the presence or absence of a value in the `DateClose` field at the index `Work`.id = 6, should change the values from NULL to '2021-04-26 21:34:30' and back...
When executed, it matches one line at a time (as expected) but no changes occur. Where did I go wrong?
UPDATE `Work` SET `DateClose` = ( CASE `DateClose` WHEN `DateClose` IS NULL THEN `DateClose` = '2021-04-26 21:34:30' ELSE `DateClose` = NULL END ) WHERE `Work`. id = 6;
The `DateClose` field has the DateTime format...
Thanks in advance
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