2024-06-11 01:23:20
oracle中前N条数据可用row_number来实现。
如表中数据:
现在要求按照ID倒序,取出前十位:
oracle中执行方法:
select t.id,t.name from
(select test.*,row_number() over (order by id desc) rn from test) t
where rn<=10;
结果:
2024-06-11 03:52:39
2024-06-11 05:02:20
2024-06-11 04:09:58
2024-06-11 02:04:10