• have a look at this

    create table #t1 (id int, status varchar(10), tme time)

    insert into #t1 select 1,'started','07:00' union all

    select 1,'running','08:00' union all

    select 1,'completed','09:00' union all

    select 2,'started','10:00' union all

    select 2,'running','11:00'

    ;with cts

    as (

    select id,max(tme) tm from #t1

    group by id)

    select a.* from #t1 a inner join

    cts b on a.id=b.id and tm=tme

    order by a.id

    ***The first step is always the hardest *******