Can anyone tell me what the result to the following should be according to the standard (a reference 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);
The point is: Does the last row get updated, since if the rows are updated in order and the average is recalculated for each row, it will satisfy the condition, or does it not get updated because any data changed by this statement will only be readable after the whole statement ran?
EDIT And 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);