You|You can't specify target table 'device' for update in FROM clause
【You|You can't specify target table 'device' for update in FROM clause】delete from device where id =
(select d.id FROM device d LEFT JOIN river_chief rc on rc.river_id = d.river_id
LEFT JOIN chief c on c.id = rc.chief_id
WHERE c.user_id = '1' AND d.id ='#')
You can't specify target table 'device' for update in FROM clause 因为直接到的device表中的id , 在mysql中无法直接通过这种方式操作, 需要通过中间表来操作。
delete from device where id in
(select a.id from
(select d.id FROM device d LEFT JOIN river_chief rc on rc.river_id = d.river_id
LEFT JOIN chief c on c.id = rc.chief_id
WHERE c.user_id = '1' AND d.id ='c2ce10f7c59049fc8bb686866daf0ba4') a
)
推荐阅读
- 我爱你,但请给我安乐死的自由
- canvas(一)基本用法
- cannot|cannot be read or is not a valid ZIP file
- vue|vue canvas 手绘进度条动画
- Ditto
- canvas不过如此(一)
- 运行报错Cannot|运行报错Cannot find module '@babel/compat-data/corejs3-shipped-proposals’
- HTML|HTML canvas中translate()与rotate()的理解
- (4)Canal多实例使用
- 90天30个TED演讲|90天30个TED演讲 - Day 25: How to get your ideas to spread