问题描述
想要在查询中用in中使用limit
SELECT * from t_order where order_no in ( SELECT distinct order_no from t_order where order_no is not null and order_no <> '' limit 0, 2 )
报错:
1235 - This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery', Time: 0.010000s
问题解决
在子查询中再套一层,对in来说,就没有直接的limit了
SELECT * from t_order where order_no in ( select order_no from (SELECT distinct order_no from t_order where order_no is not null and order_no <> '' limit 0, 2) as t1 )
文章评论