Admin Admin
Number of posts : 216 Registration date : 2007-01-01
| Subject: 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/ , 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 http://digg.com/u3BhxP | |
|