There is a table:
declare @Results table(ParticipId int, Mark int) insert into @Results values (1, 10) insert into @Results values (1, 14) insert into @Results values (1, 13) insert into @Results values (2, 13) insert into @Results values (2, 13) insert into @Results values (2, 10) select * from @Results It is necessary in the resulting table to get the sum of the two best values for the Mark column for each ParticipId , ie:
How to make a request for this?
My thoughts revolve around using generic table expressions (CTE) and using a subquery for a query using ORDER BY DESC and TOP 2 . But he didn’t come up with anything practical to get his hands on.


ParticipId=1SumBest3Markis 24, not 27? - Regent27. - Adam