• nice job providing the sample data!

    in this case, you need to get the "sets" organized first so they can be compared.

    Someone else may have another method, but i thought using FOR XML to create a comma delimtied list would work fine.

    select distinct T1.worker_id,AllRateCodes.Codez from #worker_rate T1

    cross apply (SELECT Codez = STUFF((SELECT ',' + T2.rate_code

    from #worker_rate T2

    where T1.worker_id = T2.worker_id

    ORDER BY rate_code

    FOR XML PATH('')),1,1,'')) AllRateCodes

    now that that is organized, I'm not sure if you need more than that, since it's visualized, ort if you need to join that resultset agaisnt itself so you can compare them?

    i'm ASSUMING workerid is integers here really so i can order by and prevent duplicates(ie 1=2 and 2=1, which is repetitively redundant)

    With MyCTE

    AS

    (

    select distinct T1.worker_id,AllRateCodes.Codez from #worker_rate T1

    cross apply (SELECT Codez = STUFF((SELECT ',' + T2.rate_code

    from #worker_rate T2

    where T1.worker_id = T2.worker_id

    ORDER BY rate_code

    FOR XML PATH('')),1,1,'')) AllRateCodes

    )

    SELECT * FROM MYCTE T1 INNER JOIN MyCTE T2

    ON T1.Codez = T2.Codez

    WHERE T1.worker_id <> T2.worker_id

    AND T1.worker_id < T2.worker_id

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!