How To Forums

Rudebox How To Forums - Ask Anything, View How To's
HomeFAQSearchRegisterMemberlistUsergroupsLog in

Share | 

 Difference between ROW_NUMBER() and RANK() in MSSQL

Go down 

Number of posts : 216
Registration date : 2007-01-01

PostSubject: Difference between ROW_NUMBER() and RANK() in MSSQL   Sun Aug 30, 2009 7:59 pm

Contrary to popular belief, RANK() does not sort rows based upon how bad they smell. RANK() does much the same thing as ROW_NUMBER(), only it acknowledges ties in the columns specified in the ORDER BY clause, and assigns them the same rank. Where a tie occurs (as was the case for orders 6/3, and 1/5/Cool, the numbers that would otherwise have been “used up” are skipped, and numbering resumes at the next available number. As you can see, RANK() leaves a gap whenever there is a tie.

For more info and examples about this visit
Back to top Go down
View user profile
Difference between ROW_NUMBER() and RANK() in MSSQL
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum How To Forums :: How To - Programming-
Jump to: