sql server如何分组编号
对jibieName 名称进行分组排序 生成名次
SELECT [XuanShouId]
,[JibieId]
,[Zhuangtai]
,[ThisZhuangtaiInt]
,[MaxMaxZhuangtai]
,[FirstChangZong]
,[SecondChangZong]
,[ZongfenZong]
,[JinggaoZong]
,[Mingci]
,[TMingciTongji]
,[TShuangjian]
,[TJizongfen]
,[TJiyouchang]
,[ZubieYuan]
,[TShifenShao]
,[MingciSet]
,[Id]
,[Bianhao]
,[JiBie]
,[Xingming]
,[Danwei]
,[JibieName]
,ROW_NUMBER() over (partition by jibieName order by TMingCiTongji) as Paixu ---这一列就是排序列使用partition 分区参数来分区展示
FROM [ShuaijiaoBianpai2022].[dbo].[TuanTiTongji] a
partition 分区操作
partition by jibieName order by TMingCiTongji
解释;
以jibieName列为标准分区;类似于Groupby;以TMingCiTongji为排序