The difference for ROW_NUMBER/RANK/DENSE_RANK/NTILE
摘要:
USE tempdbGOCREATE TABLE Table1( ID INT IDENTITY(1,1) NOT NULL, UserID INT NOT NULL)GOINSERT INTO Table1(UserID)SELECT 1UNION ALLSELECT 1UNION ALLSELECT 3UNION ALLSELECT 4UNION ALLSELECT 5GOSELECTUserID,ROW_NUMBER()OVER(ORDER BY UserID) AS RowNumberID,RANK()OVER(ORDER BY UserID) AS RankID,DENS... 阅读全文
posted @ 2012-02-05 21:32 笑东风 阅读(206) 评论(0) 推荐(0) 编辑