Código SQL [-] select id, max(sec), valor from tabla group by id, valor
select id, max(sec), valor from tabla group by id, valor