这是我的剧本
SELECT COUNT( [Id]) as [Count Of Register], Tag as [Tag] FROM [Members] Group By Tag Order By [Count Of Register] Desc;
返回的表是这样的:
Count Tag 550 ----1 550 ----2 545 ----3 545 ----4 545 ----5
因此,这一次,我需要“标记计数”,“按此新的计数字段分组”。
一些返回的值,例如:
2 ---550 3 ---545
有什么方法可以不通过查询使用新表或模板表或任何存储表吗?
SELECT [Count Of Register], COUNT(1) [Grouped Count] FROM ( SELECT COUNT( [Id]) as [Count Of Register], Tag as [Tag] FROM [Members] Group By Tag ) MyTable GROUP BY [Count Of Register]