侠
侠圣
Unregistered / Unconfirmed
GUEST, unregistred user!
假设一个query返回100条记录(经过排序),如何取出其中部分记录,如1到10,或者30-50
等。后台数据库是oracle。另外下面这条sql语句错在什么地方?
select * from (select pgm_id,count(*) as times from vod_rec group by pgm_id order by times desc)
where rownum<11
写成(不加排序)
select * from (select pgm_id,count(*) as times from vod_rec group by pgm_id)
where rownum<11
就对了
我得目的是要实现返回排序后记录中的第m名到第n名
等。后台数据库是oracle。另外下面这条sql语句错在什么地方?
select * from (select pgm_id,count(*) as times from vod_rec group by pgm_id order by times desc)
where rownum<11
写成(不加排序)
select * from (select pgm_id,count(*) as times from vod_rec group by pgm_id)
where rownum<11
就对了
我得目的是要实现返回排序后记录中的第m名到第n名