How to retrieve the top N rows for each group

This script illustrates how to retrieve the top N rows for each group. The first solution can be used with SQL Server 2000 and upward versions, the second solution applies to SQL Server 2005 and upward versions with common table expression feature and Row_Number() function.

 
 
 
 
 
(4)
836 times
Add to favorites
Databases
7/29/2013
E-mail Twitter del.icio.us Digg Facebook