@Features mysql 执行语句默认不是阻塞的,不然数据库做不了并发; #7 典型的事务隔离问题;
语句开启需要事务,rc 级别即可: begin transaction; //for update 注意是关键!!! SELECT * FROM `order` WHERE `member_id` = 39 AND `sn` = 20220331783 for update; INSERT INTO `order` SET `sn` = 20220331783 , `member_id` = 39; UPDATE `order` SET `sum` = `sum`+1; commit;