MYSQL數據庫 UPDATE和DELETE操作,where in條件報錯的解決辦法

#子查詢(不支持)
update question q set q.`level`=2 where q.id in( select id from  question where id>=2111 limit 165,165);


#改寫
update question q inner join ( select id from  question where id>=2111 limit 165,165) t on q.id=t.id set q.`level`=2;


#子查詢(不支持)
delete from `user` where id in (
   select min(id) as id from `user` group by wx_open_id having count(1)>1
);

#改寫
delete from `user` where id in (
    select id from(    
       select min(id) as id from `user` group by wx_open_id having count(1)>1
    ) t
);

發佈了24 篇原創文章 · 獲贊 0 · 訪問量 8212
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章