摘要:
1.认识排名函数--不分组,直接对整张表的某列的值进行排名,并产生一个排名值SELECT ROW_NUMBER() OVER(ORDER BY a.Name) AS rowNumber,a.Name FROM dbo.ReplyData a --PARTITION BY a.NAME,根据Name字段进行分组,再按num进行排名SELECT ROW_NUMBER() OVER(PARTITION BY a.Name ORDER BY Num) AS rowNumber,a.Name,a.Num FROM dbo.ReplyData a2.创建测试数据CREATE TABLE #temp... 阅读全文