So in general, I feel the INSERT method is both best and easiest to use.
Notes: That index addition is necessary because on larger tables my SQL would rather die than figure to (internally) index a single column join.
I was not able, using my SQL 4.1.1, to do this as a subquery: UPDATE Groups LEFT JOIN (SELECT Group Id, MIN(Val Within Group) AS base Val FROM Groups GROUP BY Group Id) AS Grp Sum USING (Group Id) SET Val Within Group=Val Within Group-base Val; Csaba Gabor UPDATE Syntax with "on-line" updating value limitations.
UPDATE table SET Col1 = 1 WHERE id = 1; UPDATE table SET Col1 = 2 WHERE id = 2; UPDATE table SET Col2 = 3 WHERE id = 3; UPDATE table SET Col1 = 10 WHERE id = 4; UPDATE table SET Col2 = 12 WHERE id = 4; variant, a variant with "case / when / then" clause and a naive approach with transaction. The overall conclusion is that the variant with case statement turns out to be twice as fast as two other variants, but it's quite hard to write correct and injection-safe code for it, so I personally stick to the simplest approach: using transactions.
Edit: Findings of Dakusan prove that my performance estimations are not quite valid.