If I want to update a column value base on a condition I can just use the below query for a simpel +1 -1 case (translate into proper PHP call or ORM equivalent, of course):
UPDATE articles SET STATUS = 0 WHERE STATUS = 1;
But now the issue is that I want, based on the original the status
, infer a new value of status
from a dictionary. Assuming that the dictionary is something like this:
dict['1']='3'
dict['12']='2'
dict['6']='2'
There is no relationship between key-value pair. The dict
is a PHP dictionary object, that's what I meant by "in memory dictionary
".
How to write this query?
Edit: Question edit. I didn't frame the question properly... sorry!