获取分组后的取第一条数据

SELECT * FROM (
				 SELECT ROW_NUMBER() OVER (PARTITION BY StudentID ORDER BY StudentNo DESC ) AS rowid,* FROM #Tb
				 ) AS MM 
				 WHERE MM.rowid=1

 

你可能感兴趣的:(获取分组后的取第一条数据)