mysql - Order of execution of SQL UPDATE while updating multiple values? -


what sequence in values (separated commas) updated?

$command = sprintf('update %s set rating = ((rating * rating_count + %f) / (rating_count + 1.0)) , rating_count=rating_count+1 id=%d', $table, $ratinggiven, $id)`; 

i want make sure that

rating = (rating * rating_count + %f) / (rating_count + 1.0) 

is executed before

rating_count=rating_count+1 

without firing 2 sql commands.

i not sure if update-value-statements executed in order in separated commas in mysql (or other db)?

i don't think matter update read current row , update upon based on existing values, , not ones in update.

so in both set operations, original value of rating_count used.


Comments

Popular posts from this blog

Winapi c++: DialogBox hangs when breaking a loop -

vb.net - Font adding using PDFsharp -

javascript - jQuery iScroll clickable list elements while retaining scroll? -