某个表按某个列分组且按另一个列排序
SELECT *,ROW_NUMBER() OVER(PARTITION BY bc ORDER BY CONVERT(int,firstOrder) ASC) AS num
FROM #temp
版权声明:本文为VictorBlog原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
SELECT *,ROW_NUMBER() OVER(PARTITION BY bc ORDER BY CONVERT(int,firstOrder) ASC) AS num
FROM #temp