Rownumber/Rank a result set

  • Friends, I have a resultset where I have EmployeeID, EmpName

    EmployeeID EmpName

    1 ABC

    1 ABC

    1 ABC

    2 LMN

    2 LMN

    3 PQR

    4 XYZ

    5 DEF

    5 DEF

    I want to row_number()/ rank() the EmployeeID in the following manner

    RowID,EmployeeID EmpName

    11 ABC

    21 ABC

    31 ABC

    12 LMN

    22 LMN

    13 PQR

    14 XYZ

    15 DEF

    25 DEF

  • ROW_NUMBER() OVER (PARTITION BY employee_id ORDER BY employee_id)

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply