22,302
社区成员




select top 5 [网元],count(*) as 数量,
[标题]=(select top 1 [标题] from [dbo].[table] where [网元]=t.[网元] group by [标题] order by count(1) desc)
FROM [dbo].[table] as t group by [网元] order by 数量 desc
select top 5 [网元],count(*) as 数量,
[标题]=(select top 1 [标题] from [dbo].[table] where [网元]=t.[网元] group by [标题] order by count(1) desc)
FROM [dbo].[table] as t order by 数量 desc
select top 5 [网元],count(*),[标题] FROM [dbo].[table] where [标题] in
(select top 5 [标题] from [dbo].[table] group by [标题] order by
count(*) desc) group by [网元],[标题] order by count(*) desc
最好给出完整的表结构,测试数据,计算方法和正确结果.