Sql += 时事务问题
表结构
开启两个会话
会话A和会话B
会话A开启事务
会话B开启事务
会话A修改值
update test set value = value + 1 where id = 1;
会话A查询值
select value from test where id = 1;
```sql
![](https://img2020.cnblogs.com/blog/1410909/202108/1410909-20210825183558512-1669303133.png)
### 会话B查询值
```sql
select value from test where id = 1;
```sql
![](https://img2020.cnblogs.com/blog/1410909/202108/1410909-20210825183638953-1458746126.png)
### 会话B修改值
```sql
update test set value = value + 1 where id = 1;
会话B被阻塞
会话A提交事务
会话B修改成功