• Koen's query is much easier, but here's my alternate query anyway.

    WITH cteRoles

    AS

    (

    SELECTROW_NUMBER() OVER (PARTITION BY Name ORDER BY NAME) RowNr,

    Name,

    Role

    FROMSample

    )

    SELECTName

    FROMcteRoles

    WHERERowNr = 2



    For better, quicker answers on T-SQL questions, read Jeff Moden's suggestions.[/url]

    "Million-to-one chances crop up nine times out of ten." ― Terry Pratchett, Mort