Quick Question,
I need to select, add and update a mysql table all in one query. Does anybody have any suggestions?
For example. I need to know the number of a field in a table, once i get the number i need to increament/decreament it by a given number, then i need to update that field.
I need to do it all in one shot cause i have a script that increaments it at least 5 times a second. Now, i know i can do seperate calls but not sure if i would be getting the right amount that percise second.
Not sure if i'm making sence, but can anybody help? I've checked mysql.com and couldn't find anything that could help me.... or i just didn't know what to look for.
thanks
Mysql Question!
Moderator: General Moderators
Something like this should work:
Code: Select all
UPDATE
some_table
SET
changing_field = changing_field + 1
WHERE
id = 'some_id_value'Real programmers don't comment their code. If it was hard to write, it should be hard to understand.