请检查以下mysql语句存在的错误,并修正他SELECT SUM(fen_shiji) AS total_fen_shiji FROM luzhi_jilu_xijie WHERE id_jilu_all = '350' UPDATE luzhi_jilu_all SET fen_this = 100 - total_fen_shiji, isDelete = '完成', date_finish = '2023-07-14' WHERE id = '350'
时间: 2024-04-16 11:26:46 浏览: 135
mysql SELECT FOR UPDATE语句使用示例
请注意,您提供的MySQL语句存在一些错误。在一个查询语句中不能同时包含SELECT和UPDATE操作。您需要将它们分开为两个独立的语句。以下是修正后的语句:
首先,执行SELECT语句获取总分数:
```
SELECT SUM(fen_shiji) AS total_fen_shiji FROM luzhi_jilu_xijie WHERE id_jilu_all = '350';
```
然后,使用UPDATE语句更新记录:
```
UPDATE luzhi_jilu_all SET fen_this = 100 - (SELECT SUM(fen_shiji) FROM luzhi_jilu_xijie WHERE id_jilu_all = '350'), isDelete = '完成', date_finish = '2023-07-14' WHERE id = '350';
```
请注意,这里假设您的表和字段名称是正确的。如果有任何其他问题,请告诉我。
阅读全文