SQL分组排序去重复的小实例
程序员文章站
2023-12-06 12:32:52
复制代码 代码如下:select *from ( &n...
复制代码 代码如下:
select
*
from
(
select
userid,
classid,
remark,
row_number () over (
partition by userid,
classid
order by
addtime desc
) as row_bank
from
eng24vipcourseintention
) as ta
where
row_bank = 1
==========================
partitionbyuserid,classid 这里是按什么分组, 注意一下。