Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««1234

Returning the Top X row for each group Expand / Collapse
Author
Message
Posted Friday, November 23, 2012 5:53 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Tuesday, July 15, 2014 7:03 AM
Points: 1,949, Visits: 8,303
ganotedp (11/23/2012)
Why not DENSE_RANK instead of ROW_NUMBER?


Hi ganotedp,

The article does state

If there were ties and we wanted each of them treated the same then we would use the DENSE_RANK function rather than ROW_NUMBER. In some systems if there is a tie, for example two runners finished in exactly the same time for first place, then there is no following position. That means no second place runner and we skip to third. We would then use the RANK function. In our example, however, we are going to ignore the possibility of ties.




Clear Sky SQL
My Blog
Kent user group
Post #1388145
Posted Sunday, November 25, 2012 8:00 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, July 21, 2014 1:20 AM
Points: 11, Visits: 27
Great article - especially the CROSS APPLY option. I've come across the need for this several times (although sadly have been constrained by SQL 2000, which doesn't work with either option).
Post #1388428
Posted Monday, November 26, 2012 3:38 AM


Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Sunday, May 19, 2013 8:22 AM
Points: 17, Visits: 148
Thank you.
Post #1388499
Posted Monday, December 24, 2012 11:54 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Monday, April 15, 2013 11:42 PM
Points: 424, Visits: 55
Nice article.
Post #1399948
« Prev Topic | Next Topic »

Add to briefcase «««1234

Permissions Expand / Collapse