oracle 分页 orderby

select *from (select rownum rn,a.* from (select i.img_id,i.img_url,t.news_id,t.news_title,t.news_detail,t.news_date,t.match_type from news_data t left join (select x.img_id,x.news_id,x.img_url from news_image x where (x.news_id,x.img_id) in (select y.news_id,min(y.img_id) from news_image y group by y.news_id)) i on t.news_id = i.news_id where t.news_type = 3 and t.news_date between to_date('2011-12-29 00:0000','yyyy-mm-dd hh24:mi:ss') and to_date('2013-12-29 23:59:59','yyyy-mm-dd hh24:mi:ss')  order by t.news_date desc) a where rownum <= 5 ) where rn > 0

相关推荐