MySQL: update a Field only if condition is true.Update a field only if condition is true in query
Using IF Statement we can do this
For example :- If i want to update user level if user score is 500+
and if user join time in 24 hour
We can add multiple condtion in IF statement
level = IF(score > 500 AND jointime (HOUR, jointime , ‘2018-06-27 16:27:54’) > 24 , USERNEWLEVEL , level) WHERE
user_id = 5
The post MySQL: How to update a field only if condition is true appeared first on PHPCORELAB.