delete from A where a_id in (select id from B where b_id in (select id from C where c_id = ?))

delete from A where a_id in (select id from B where b_id in (select id from C where c_id = ?))

题目
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?
答案
IN中的数据量不能大于2K条,否则会报错
先使用SELECT语句将数据查询到一张临时表
然后使用INNER JOIN进行内联删除
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
最新试题
热门考点

超级试练试题库

© 2017-2019 超级试练试题库,All Rights Reserved.