首页
技术博客
登录
6mi
u
盘
搜
搜 索
技术博客
Oracle 分组排序取第一条数据
Oracle 分组排序取第一条数据
tech
2026-03-12
4
需求: 先分组,再按时间排序,最后取分组第一条数据
利用oracle的开窗函数可以实现
以下是模板sql ,自行替换
select t.* from (select a.*, row_number() over(partition by 需要分组的字段 order by 更新时间 desc) rw from 表 a) t where t.rw = 1
转载请注明原文地址:https://tech.qufami.com/read-27298.html
最新回复
(
0
)