tags:

views:

223

answers:

2

Hi,

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?

+8  A: 

Absolutely. You can even reference the current value of the column in the set:

UPDATE table SET x = x + 5 WHERE x < 3

bobwienholt
A: 

I see no problem, and you can do a lot more...

CMS