Adding row numbers to SQL results By Vampire | March 9, 2019 - 7:35 pm |March 9, 2019 Code snippets, SQL SELECT ROW_NUMBER() OVER (PARTITION BY GROUPING_COL ORDER BY ID_COL) AS rn, ID_COL, GROUPING_COL, SOME_VALUE, SOME_VALUE2 FROM SQL_TABLE Bookmark the permalink.