I am trying to use the following query.i want to get last 7 days rows based on status_date, i would like to partition the data after it gets last 7 days data on that would like to apply the partition.SELECT acct_unit, STATUS_DATE, STATUS_FLAG, SUR_KEYFROM (select acct_unit, STATUS_DATE, STATUS_FLAG, SUR_KEY, Row_number() over(partition by acct_unit order by STATUS_DATE DESC) rn FROM TSPI ) temp WHERE rn <=2
Thank you very much for the helpful info.