MSSQL query to select top 2 values
There are different ways to do this ...
Here is one
CREATE TABLE Table1
    ([RowNum] int, [Interface] varchar(5), [TIME] int)
;
    
INSERT INTO Table1
    ([RowNum], [Interface], [TIME])
VALUES
    (1, 'Intf1', 0),
    (2, 'Intf2', 3),
    (3, 'intf5', 1),
    (4, 'Intf2', 4),
    (5, 'intf3', 3),
    (6, 'Intf2', 2),
    (7, 'intf3', 5),
    (8, 'intf3', 2),
    (9, 'inft4', 2),
    (10, 'Intf2', 0),
    (11, 'intf5', 1)

SELECT t.*
FROM table1 as t
  INNER JOIN
  (
     SELECT Interface, Time , 
         ROW_NUMBER() OVER(ORDER BY a.Time dESC) as rn
     FROM Table1 as a
  ) AS P
  ON t.Interface = p.Interface
WHERE
  p.rn &lt;=2
ORDER BY p.Time DESC,p.Interface,t.Time DESC

And output:
RowNum  Interface   TIME
7   intf3   5
5   intf3   3
8   intf3   2
4   Intf2   4
2   Intf2   3
6   Intf2   2
10  Intf2   0

dbfiddle