Here it is: http://stackoverflow.com/questions/1139719/sql-server-query-for-rank-rownumber-and-groupings
Here is my query and resultset
SELECT Rank() over (Partition by EncounterID Order by EncounterID, RefPhysID)+1 as ranks ,EncounterID , RefPhysID FROM tbEncountersCourtesyCopies Group By EncounterID, RefPhysID, RefPhysOfficeID Order by ranks asc
ranks EncounterID RefPhysID 2 9 1022 2 12 1095 2 18 91 3 12 1279
No comments:
Post a Comment