17,377
社区成员
发帖
与我相关
我的任务
分享
select * from
( select A.*,rownum r
from (select * from table_data where active='Y' order by s_time desc)
A where rownum <= 15
) where r >0
select a.*, row_number() over (order by id) rn from a a where rn <= 15;
--嵌套太多了
select a.* ,rownum rn
from table_data a
where active='Y' and rownum <= 15
order by s_time desc
--上面就可以了 就是1到15的 默认是1开始的
select * from
(select a.* ,rownum rn
from table_data a
where active='Y' and rownum <= 15
order by s_time desc) t
where rn>=n and rn<=m
--随你哪条到哪条
select A.*, rownum r
from (select * from table_data where active='Y' order by s_time desc) A
where rownum <= 15;