• I wonder if checksum could be an alternative to a two-step process suggested by the article?

    Something to the effect:

    ; WITH CTE

    as (

    SELECT worker_id,

    CHECKSUM_AGG(CHECKSUM(rate_code)) as chk

    FROM #worker_rate

    GROUP BY worker_id

    )

    SELECT worker_id,

    DENSE_RANK() OVER (ORDER BY chk) as SNO

    FROM CTE