窗口函数 row number + partition by 排序

窗口函数 row number + partition by 排序

数据排序后再取第一个值

select * from

(
select *,
Row_Number() over (partition by uid order by created_at ) rank
from ods_lps_kkb_cloud_edu.student_homework_record
where
homework_id=37
)
rank=1

 

posted @ 2021-04-28 15:54  半个程序猿Cohen_Lee  阅读(170)  评论(0编辑  收藏  举报