SQL to get 1st record of a range

If you want to get the 1st record of range records, you can use this SQL command.

1SELECT * FROM
2(SELECT DISTINCT rank() over(PARTITION BY a.username ORDER BY a.update_dt desc) rn, a.*
3   FROM table_name a
4  WHERE a.update_dt >  p_cur_timestamp
5    AND a.update_dt <= p_cur_timestamp + C_PERIOD
6 ) 
7WHERE rn = 1