delete查询由于mysql旧版本而无法工作

8wtpewkr  于 2021-06-21  发布在  Mysql
关注(0)|答案(1)|浏览(350)

这个问题在这里已经有答案了

这个版本的mysql还不支持limit&in/all/any/some子查询(5个答案)
两年前关门了。
我编写了以下查询,只删除100行:

delete T1 from table1 T1
INNER table2 T2 ON
T1.column1 = T2.column1
where T2.id IN(select id from table2 where date >= '2001-01-01' limit 100)

我犯了个错误 This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'

70gysomp

70gysomp1#

你可以用join代替in delete T1 from table1 T1 INNER table2 T2 ON T1.column1 = T2.column1 JOIN (select id from table2 where date >= '2001-01-01' limit 100) AS temp On temp.id =T2.id

相关问题