不啰嗦,直接上图,大概实现效果如下:
有上面这样一份数据,将他们按照userAccount和submitTime进行分组,然后提前每组数据的前两条记录
提取后数据如下:
实现的SQL如下:
select t.* from
(select *,row_number() over(partition by userAccount, submitTime order by submitTime) rn from demoTable) t
where rn <=2
@_@! 结束啦~~
不啰嗦,直接上图,大概实现效果如下:
有上面这样一份数据,将他们按照userAccount和submitTime进行分组,然后提前每组数据的前两条记录
提取后数据如下:
实现的SQL如下:
select t.* from
(select *,row_number() over(partition by userAccount, submitTime order by submitTime) rn from demoTable) t
where rn <=2
@_@! 结束啦~~