Usando OVER(PARTITION BY ), no necesitará una unión en SQL Server
SELECT *, 100*Grade/ SUM(Grade) OVER(PARTITION BY ID) AS Percentage
FROM (
VALUES(1, 10),(1,20), (2, 15), (2,24), (2,16), (3,29)
) your_table (ID, GRADE)
Usando OVER(PARTITION BY ), no necesitará una unión en SQL Server
SELECT *, 100*Grade/ SUM(Grade) OVER(PARTITION BY ID) AS Percentage
FROM (
VALUES(1, 10),(1,20), (2, 15), (2,24), (2,16), (3,29)
) your_table (ID, GRADE)