- ORACLE中rownum和order by的优先级比较
rownum和order by的优先级比较是要分情况的:
order by 索引,主键时,即可让oracle先按该字段排序,然后再用rownum标号。
order by 普通列时,先rownum后order by。
比较保险的写法是:
select * from (select 查询字段 from 查询表 order by 排序字段 ) where rownum<= N;
select t.CREATE_TIME from table_name t where rownum = 1 order by t.CREATE_TIME desc; 加一层嵌套写法: select * from (select t.* from table_name t order by t.CREATE_TIME desc) where rownum = 1;
标签:CREATE,TIME,Oracle,rownum,where,order,select From: https://www.cnblogs.com/lbzwd/p/17261029.html