查询商品分类下价格最高的两条商品
SELECT
a.*
FROM
product AS a
WHERE
( SELECT count(id) FROM product b WHERE b.category_id = a.category_id AND b.id>a.id )<2
AND category_id IN (1,2) ORDER BY category_id desc
查询商品分类下价格最高的两条商品
SELECT
a.*
FROM
product AS a
WHERE
( SELECT count(id) FROM product b WHERE b.category_id = a.category_id AND b.id>a.id )<2
AND category_id IN (1,2) ORDER BY category_id desc