row_id用法:
select a.*
from (select union_id,contra_no,row_number() over(partition by union_id order by create_tm desc) as row_id from table where contra_no like'14%' and end_date='47121231')a
where a.row_id=1
limit 5
按照union_id分组,create_tm降序
row_id=1 表示每个用户选择一条记录;