当前位置:网站首页>oracle分组取最大值
oracle分组取最大值
2022-07-27 22:39:00 【贾斯汀_abc】
比如表 test
| recid | listid |
| 1 | 1 |
| 1 | 2 |
| 2 | 3 |
| 2 | 7 |
| 1 | 4 |
想得到的数据是按照listid分组,然后取出每组中recid最大的那几条纪录。
结果应该是这两条纪录:
字段:listid recid
1 2
2 5
SQL如下:
select listid,recid
from ( select listid,recid,row_number() over(partition by listid order by recid desc) rn
from test)t1 where rn=1;边栏推荐
- Branch and loop sentence exercises
- 如果某个表有近千万数据,CRUD比较慢,如何优化
- Learning note 12: Eratosthenes screening method to find prime numbers (within 100) and magic square matrix
- Jerry Zhi has problems in real-time adjustment of sound change effect in magic sound mode [chapter]
- Network equipment hard core technology insider firewall and security gateway chapter (VI) security double repair under the law
- iperf安装与使用
- LeetCode - 寻找两个正序数组的中位数
- Retinanet网络结构详解
- 网络设备硬核技术内幕 防火墙与安全网关篇 (十)
- Database daily question --- day 22: last login
猜你喜欢

Code random notes_ Hash_ 1002 find common characters

接口测试实战项目02:读懂接口测试文档,上手操练

KMP review + AC automata Prequel

代码随想录笔记_哈希_1002查找共用字符

iperf安装与使用

110. In depth introduction to sap ui5 fileuploader control - why do you need a hidden iframe

Postman下载、使用教程

怎么清晰地理解、表达 IaaS 、 PaaS 、 SaaS ?
![[CruiseControl]Build Result JSP](/img/80/11c2b539c217ecd6ba55668d3e71e9.png)
[CruiseControl]Build Result JSP

Examples of application of JMeter in performance testing
随机推荐
Postman下载、使用教程
Network device hard core technology insider firewall and security gateway (10)
Learning note 12: Eratosthenes screening method to find prime numbers (within 100) and magic square matrix
Swear, swear, swear
Recommended system model: DSSM twin tower model for embedded recall
Oracle错误: ORA-01722 无效数字
Can TSMC Samsung build a production line without American equipment for Huawei?
推荐系统-指标:ctr、cvr
Oracle error: ora-01722 invalid number
[introduction to C language] zzulioj 1026-1030
代码随想录笔记_哈希_1002查找共用字符
[STM32] watchdog module
Byte flybook Human Resource Kit three sides
Function related knowledge
融云 IM & RTC 能力上新盘点
LeetCode - 寻找两个正序数组的中位数
Jerry's prompt sound processing when switching devices [chapter]
Jericho will make a popping sound when turning on, broadcasting a prompt tone, and turning off [chapter]
Demo: the test interface receives duplicate data and creates documents in a short time
Postman download and use tutorial