Hey
I'm wondering if it's possible to do one-query updates to numerical data in a mySQL row. Something along the lines of
UPDATE table WHERE condition SET value=value+1;
Effectively what I want to do is increment a value of a row without doing all this:
SELECT * FROM table WHERE condition;
[I]Then use a bloated loop to extract the one value x I want on one row.[/I]
x = x + 1;
UPDATE table WHERE condition SET value=x;
Ultimately, I'm hoping to be able to do this:
UPDATE table WHERE variable=value SET value=value+1;
UPDATE table WHERE variable=value+1 SET value=value-1;
Problem with this 'swap' operation (if you imagine the variable to be an integer order code) is that the second query will affect both rows, I need to execute them concurrently I'm guessing. Can that be done?
Cheers