抓某個區間的第一筆資料

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