select shop_product.productid,shop_product.name,shop_product.icon,shop_product.price,shop_product.unit,shop_product.description,shop_product_category.catid from shop_product
inner join shop_product_category
on shop_product.productid in (select productid from shop_product_category where catid = 1 limit 10) and shop_product.productid = shop_product_category.productid
This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
子查询里面不能有limit
于是乎
select shop_product.productid,shop_product.name,shop_product.icon,shop_product.price,shop_product.unit,shop_product.description,shop_product_category.catid from shop_product inner join (select productid from shop_product_category where catid = 1 limit 10) as pro_all on shop_product.productid = pro_all.productid inner join shop_product_category on shop_product.productid = shop_product_category.productid
这样的语句是不能正确执行的。
select * from table where id in (select id from table limit 10);
但是,只要你再来一层就行,如:
select * from table where id in (select t.id from (select * from table limit 10)as t)