mySQL 查询每个店铺销量最高的商品信息
如果要取前3或者前10只需要where a.group_id<=3where a.group_id<=10SQL如下:效果相当于手动分组,排序,取前Nselect a.*from(select t1.*,(select count(*)+1 from t_product_info1 where store_name=t1.store_name and sell_...
·
如果要取前3或者前10只需要where a.group_id<=3
where a.group_id<=10
SQL如下:效果相当于手动分组,排序,取前N
select a.*
from
(
select t1.*,(select count(*)+1 from t_product_info1 where store_name=t1.store_name and sell_num>t1.sell_num) as group_id
from t_product_info1 t1
) a
where a.group_id<=1
更多推荐
已为社区贡献1条内容
所有评论(0)