If I understand your question correctly the example data in your question is stored in a table, and it's not a result from a PIVOT query. If that is the case, the first thing to understand is that the rows are in no particular order in a table. In other words, in order to group them you would need to have a column or an expression that would be common for the following rows
COMP 500 300 100 30 10 3
7977797 19.67 NULL NULL NULL NULL NULL
7977797 NULL -3.99 NULL NULL NULL NULL
7977797 NULL NULL -7.92 NULL NULL NULL
7977797 NULL NULL NULL -27.3 NULL NULL
7977797 NULL NULL NULL NULL -145.2 NULL
7977797 NULL NULL NULL NULL NULL -86.26
and be common for the following rows but different from the previous group
COMP 500 300 100 30 10 3
7977797 17.68 NULL NULL NULL NULL NULL
7977797 NULL -7.68 NULL NULL NULL NULL
7977797 NULL NULL -7.70 NULL NULL NULL
7977797 NULL NULL NULL -33.07 NULL NULL
7977797 NULL NULL NULL NULL -40.45 NULL
7977797 NULL NULL NULL NULL NULL -58.82
As far as I can see there is no such column in the data so it's impossible to say if for example the second row belongs to the first or the second group, again remember that the order of the rows in your data cannot be used for grouping.
If the data would contain a column like the following col1
COMP Col1 500 300 100 30 10 3
7977797 1 19.67 NULL NULL NULL NULL NULL
7977797 1 NULL -3.99 NULL NULL NULL NULL
7977797 1 NULL NULL -7.92 NULL NULL NULL
7977797 1 NULL NULL NULL -27.3 NULL NULL
7977797 1 NULL NULL NULL NULL -145.2 NULL
7977797 1 NULL NULL NULL NULL NULL -86.26
7977797 2 17.68 NULL NULL NULL NULL NULL
7977797 2 NULL -7.68 NULL NULL NULL NULL
7977797 2 NULL NULL -7.70 NULL NULL NULL
7977797 2 NULL NULL NULL -33.07 NULL NULL
7977797 2 NULL NULL NULL NULL -40.45 NULL
7977797 2 NULL NULL NULL NULL NULL -58.82
Then you could group the data by
col1
and you would get the desired result.
Having that said, you would either need to define a new column which defines the group in one way or another or use an expression from existing data to do the grouping