海量数据查询(推荐,亲测有效)
//查询淘宝销量第10高到第20高的店家
select * from (
select a.*,rownum r from (
select * from user order by sales desc
) a
where rownum<=20 order by a.sales desc
) b where r.rownum>=10
注意:
select a .*,rownum rn from
(select * from user order by sales desc) a
where rn<=10
–这个sql是错误的,起别名必须查询出数据表才行
其他方式详见:https://www.2cto.com/database/201701/585326.html