Can mysql have multiple FOR UPDATE in one transaction?

mysql can different tables FOR UPDATE multiple times in one transaction?

Jun.09,2022

Yes, such as

SET AUTOCOMMIT=0; 
BEGIN WORK;

SELECT * FROM test.B where cid=1 for update;
SELECT * FROM test.A where cid=1 for update;

update test.B set did=10 where cid=1;
update test.A set did=30 where cid=1;

commit work;
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3d94e-2bbf0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3d94e-2bbf0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?