• I believe the following statement in the article is misleading:

    You don’t need to do the SELECT first, but it is nice to see what you’ll be deleting.

    It is required that the select section be in the delete statement because the windowing functions cannot be part of the where clause. The following DOES NOT work:

    SELECT

    ROW_NUMBER() OVER ( PARTITION BY FName, LName, JobTitle, Age ORDER BY LName ) R

    , FName

    , LName

    , JobTitle

    , Age

    FROM DuplicateRow

    WHERE ROW_NUMBER() OVER ( PARTITION BY FName, LName, JobTitle, Age ORDER BY LName ) > 1

    Gives the following error:

    Windowed functions can only appear in the SELECT or ORDER BY clauses.