• Nice article, thanks for sharing.

    The same thing can be achieved with just the row_number function as well.

    select AlphaKey

    from (

    select row_number() over(partition by AlphaKey order by AlphaKey) rownum,

    AlphaKey

    from @AlphaList

    ) al

    where rownum = 1

    order by 1;