Can someone tell me that the result should comply with the following standard (a link to the correct part of the standard would be welcome)
> select * from t1; +------+ | col1 | +------+ | 9 | | 8 | | 10 | +------+ > update t1 set col1 = col1 * 2 where col1 <= (select avg(col1) from t1);
Point: is the last row updated, since if the rows are updated in order and the average value is recalculated for each row, it satisfies the condition or is not updated, since any data changed by this statement will be read only after the whole statement is completed?
EDIT What about this case?
> select * from t1; +------+------+ | col1 | col2 | +------+------+ | 9 | 1 | | 8 | 2 | | 10 | 2 | +------+------+ > update t1 p1 set col1 = col1 * 2 where col1 <= (select avg(col1) from t1 where col2=p1.col2);
source share