I like examples because documentation is hard to read. But I think the following code is what I was looking for:
START TRANSACTION;
SELECT @A:=SUM(salary) FROM table1 WHERE type=1;
UPDATE table2 SET summary=@A WHERE type=1;
COMMIT;
Only, I don't want to commit afterward because I don't want the changes to take effect. So would I leave COMMIT out then or do I have to put something like NO COMMIT or ROLLBACK?
Why is START TRANSACTION necessary?
Also, If I SET AUTOCOMMIT = 0 does it only affect the current query or will it change the database setting? Does SET AUTOCOMMIT = 0 go at the beginning or end of the query?
Thanks for the links, that was a very helpful start.