Hi @Madhu P ,
Welcome to the Microsoft TSQL Q&A Forum!
Please refer to:
CREATE TABLE #test (ID int, Name char(15), class int, score int)
INSERT INTO #test VALUES(1,'P',1,20),(2,'P',1,20),(3,'A',2,10),(3,'A',2,20)
SELECT Name,class,ID, sum(score) sum_score
FROM #test
GROUP BY Name,class,ID
ORDER BY Name DESC
Outout:
If you have any question, please feel free to let me know.
If the response is helpful, please click "Accept Answer" and upvote it.
Best Regards
Echo
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.