获取最新的一条数据

SELECT
        *
        FROM
        ( SELECT ROW_NUMBER() OVER ( PARTITION  BY b.AlarmID ORDER BY b.ResponseTime desc ) AS `ROW`,b.* FROM a_alarm_response b  ) a
        WHERE
        a.ROW = 1

你可能感兴趣的:(sql,mysql,数据库)