a.myasnikov (4/8/2014)
Just wondering what the grand-masters will say about a checksum solution?From what I know about checksums they are pretty reliable way to tell one set from the other... Any comments are welcome.
; WITH CTE
as (
SELECT worker_id,
CHECKSUM_AGG(CHECKSUM(rate_code)) chk
FROM #worker_rate
GROUP BY worker_id
)
SELECT worker_id,
DENSE_RANK() OVER (ORDER BY chk) SNO
FROM CTE
That would be a great idea and it definitely shows "thinking outside the box" but... CHECKSUM and CHECKSUM_AGG use a simple "Exlusive OR" (an "adder" by any other name) that allows for duplicates to occur.
--Jeff Moden
Change is inevitable... Change for the better is not.