[Err] 1235 – This version of MySQL doesn’t yet support ‘LIMIT & IN/ALL/ANY/SOME subquery’

IN/ALL/ANY/SOME 的子查询中用了limit关键词无法执行

select * from table_example where  id in (select t.id from table_example_b t limit 5)

这样执行会报错

[Err] 1235 - This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'

只需要在in里面在包一层select即可解决问题

select * from table_example where  id in (select t.id (select id from table_example_b limit 5) t)

发表评论

邮箱地址不会被公开。 必填项已用*标注