SQL Select Top N within Group By?
SELECT ID, groupName, hitValue,
Rank() OVER (PARTITION BY groupName ORDER BY hitValueDESC) AS Rank
FROM myHits
Subscribe to:
Posts (Atom)
SELECT ID, groupName, hitValue,
Rank() OVER (PARTITION BY groupName ORDER BY hitValueDESC) AS Rank
FROM myHits