以下内容仅做备忘

假设有以下表格【FM_ALARM】

RES_ID : 资源的唯一标识OCCUR_TIME : 发生时间(毫秒时间戳)SEVERITY : 告警级别

数据会实时变更,我要取出所有数据的最新一条记录,则可以使用以下SQL

select res_id, severity from fm_alarm t where not exists (select 1 from fm_alarm where t.res_id = res_id and t.occur_time < occur_time)