Hi @Mr. T
Please try this query:
Declare @temp table(fruit varchar(20), amount int) insert into @temp values ('Apples',10), ('Oranges',20), ('Pears',50) SELECT fruit,SUM(amount) AS Amount FROM @temp GROUP BY GROUPING SETS(fruit,())
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
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.