select t.* from(select *,row_number() over(partition by 分组字段 order by 时间字段) rn from 表名) twhere rn <=2