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?

Was it helpful?

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
scroll top