Is this correct way of update query in MySQL?
-
03-07-2019 - |
Question
I got some problems with finding a bug in php/mysql application, and I wonder if I can do something like this: UPDATE table SET userid='2' WHERE userid='1'
- > Can I update something I state in WHERE?
Solution
Absolutely. You can even reference the current value of the column in the set:
UPDATE table SET x = x + 5 WHERE x < 3
OTHER TIPS
I see no problem, and you can do a lot more...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow