作业帮 > 综合 > 作业

delete from A where a_id in (select id from B where b_id in

来源:学生作业帮 编辑:搜搜考试网作业帮 分类:综合作业 时间:2024/04/29 17:29:32
delete from A where a_id in (select id from B where b_id in (select id from C where c_id = ?))
请问这句SQL语句怎么优化? 我的意思万一in语句里面的内容过多会出问题的,怎么用连接表的形式去delete?
delete from A where a_id in (select id from B where b_id in
IN中的数据量不能大于2K条,否则会报错
先使用SELECT语句将数据查询到一张临时表
然后使用INNER JOIN进行内联删除
再问: 我需要只通过一条sql语句达到目的,你的方法能给出具体的sql吗?