SQL Query on partitioning does not run
rn cannot be referenced in WHERE because it's defined in the SELECT clause. Try using a subquery instead:

SELECT *
FROM (
    select payee_id,start_dt,
           row_number() over(partition by payee_id order by start_dt) as rn
    from xxx
) AS sub
where rn = 1;


For more reading, google "logical query processing order".