Oracle 示例:
select *
from (select a.*,row_number() OVER (partition by device_id ORDER BY gather_time desc) rn from table a where device_id=’125194’ )
where rn = 1
对device_id分组,取gather_time最大值,获取所有字段
Sybase15版本之前是不支持Over函数的
select * from table group by device_id having gather_time = max(gather_time)
可行