How to count GROUP BY rows in T-SQL
问题 I have this SQL query that does a GROUP BY to merge together all rows that contain the same Player_id but not the same Game_id: SELECT p.Player_id, p.Name, p.Position, SUM(s.Goals) AS goalsb, SUM(s.Assists) AS assistsb, SUM(s.Points) AS pointsb FROM Dim_Player AS p INNER JOIN Fact_Statistics AS s ON s.Player_id = p.Player_id GROUP BY p.Player_id, p.Name, p.Position ORDER BY pointsb DESC, goalsb DESC What I want to do is implant a COUNT each time the GROUP BY merges a row with another to