我试图让它工作,但得到一个错误t_write was not locked.
我正在从最高值更新 colmake
和 colsn
sn + 1
LOCK TABLES 1_makes AS t_read READ, 1_makes as t_write WRITE;
UPDATE t_write
SET
make = 'Pioneer',
sn = (SELECT
*
from
(SELECT
MAX(sn)
FROM
t_read
WHERE
id <> 0) as new_sn) + 1
WHERE
id = 2;
UNLOCK TABLES;