执行顺序:先执行rownum,再执行order by。
select 列名(s) from 表名 where 条件 and rownum < n order by 列名;
查询排列顺序(order by)后的前n条记录
解决思路:从排列好的列表里查询前n条
select *
from (select 列名(s) from 表名 where 条件 order by 列名)
where rownum < n;
执行顺序:先执行rownum,再执行order by。
select 列名(s) from 表名 where 条件 and rownum < n order by 列名;
查询排列顺序(order by)后的前n条记录
解决思路:从排列好的列表里查询前n条
select *
from (select 列名(s) from 表名 where 条件 order by 列名)
where rownum < n;