由于旧的 mysql 版本,删除查询不起作用

all_techie

我编写了以下查询来仅删除 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'

塔纳西斯阿凡尼提斯

您可以使用 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

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章