关于delete与updata语句中嵌套的使用问题

骑猪去赶集 2017-12-02 03:50:52
delete from user where uid in(
select uid from (
select uid as xiaojian from user
where (uid between 81 and 96)
having xiaojian<91 )
as temp );
...全文
137 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
rucypli 2017-12-04
  • 打赏
  • 举报
回复
把select结果集create到临时表 然后再执行delete create table tmp select xxx delete from tb where xxx in (select * from tmp)
zjcxc 2017-12-04
  • 打赏
  • 举报
回复
重复的问题,这个子查询单独不能执行,问题就在这里,自己想想原因(这是你自己挖的坑)
select uid from (
    select uid as xiaojian from user 
    where (uid between 81 and 96) 
    having xiaojian<91 )
as temp 

56,678

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧