加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

如何在Oracle中查询排序后的第一条记录

发布时间:2020-12-12 13:56:43 所属栏目:百科 来源:网络整理
导读:其实就是分页查询的另一种应用: select * from ( select tb.*,rownum from table_name tb where column_name like '20080311%' order by id) where rownum=1 select * from (select * from table order by key) where rownum=1; select * from (select * fr
其实就是分页查询的另一种应用:
select * from (
select tb.*,rownum from table_name tb where column_name like '20080311%' order by id)
where rownum=1

select * from (select * from <table> order by <key>) where rownum=1;

select * from (select * from <table> order by <key> desc) where rownum=1;

oracle中选出某个字段里面最大值的记录的sql语句怎么写?2种写法:select max(testfld) from test_table;select testfld from test_tablewhere rownum = 1order by testfld desc;一般只用第一种就行了。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读