Ved at bruge OVER(PARTITION BY ), behøver du ikke en join i 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)
Ved at bruge OVER(PARTITION BY ), behøver du ikke en join i 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)