根据分组取出每个分组的第一条记录数据
1.先将数据分组并对每一组进行排序;
over(partition by 分组字段 order by 排序字段)
2.根据需要获取序号1的数据
SELECT * FROM (
SELECT RECEIVE_ID,LINE_CD,REC_TIME
,ROW_NUMBER() over(partition by LINE_CD order by REC_TIME DESC) as NEWINDEX
FROM MES_BM_RECEIVE
) t
where t.NEWINDEX = 1