row_number() over(order by col2 desc)用法

select *
from (select t.*,row_number() over(partition by t.at_ab_id_n order by t.AT_SETTLE_DATE_D desc ) cn
        from mypay_account_settle t where 
        t.at_ab_id_n=201001151300000002  and
        to_char(t.at_tx_date_d,'yyyymmdd') <= &apl_date  and
        t.at_settle_type_c = '0001' )d
where cn = 1 order by d.at_tx_date_d desc;

發佈了39 篇原創文章 · 獲贊 1 · 訪問量 6萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章