select id from b group by id order by count(*) desc
--取一个id就加top 1 select top 1 id from b group by id order by count(*) desc
select top 1 id, count(*) from b group by id order by count(*) desc --这样?
嗯,谢谢。求解释。现在还不会用group by ,
select top 1 with ties id from b group by id order by count(*) desc
select top 1 with ties sku_id from ecs_goods_gallery group by sku_id order by count(*) desc错误码: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1 with ties sku_id from ecs_goods_gallery group by sku_id order by count(*) desc' at line 1
select id, count(*) from b group by id order by 2分组查询 每一个id一个组 count(*) 表示同一个id中用多少行数据
--这样?
--取一个id就加top 1
select top 1 id from b group by id order by count(*) desc
--这样?
嗯,谢谢。求解释。现在还不会用group by ,
from b
group by id
order by count(*) desc
select top 1 with ties sku_id from ecs_goods_gallery group by sku_id order by count(*) desc错误码: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1 with ties sku_id from ecs_goods_gallery group by sku_id order by count(*) desc' at line 1
select id, count(*) from b group by id order by 2分组查询 每一个id一个组 count(*) 表示同一个id中用多少行数据