create table T (id int, seq_no int, value char (1))
insert T select 1, 2, 'B'
union all select 1, 1, 'A'
union all select 2, 1, 'C'
union all select 3, 3, 'F'
union all select 3, 2, 'E'
union all select 3, 1, 'D'
union all select 4, 1, 'G'
--1
select id, max (seq_no) as seq_no from t group by id
--2
select * from T as A
where not exists (select 1 from T where id = A.id and seq_no> A.seq_no) |