forum

Home / DeveloperSection / Forums / Is it possible to calculate the sum of each group in a table without using group by clause in SQL Server?

Is it possible to calculate the sum of each group in a table without using group by clause in SQL Server?

Anonymous User228422-Sep-2014

I am trying to find out if there is any way to aggregate a sales for each Book. I realize I can achieve it either by using group-by clause or by writing a procedure. Example:

Table: Details

Sales                     Book

10                           C Language

20                           C Language

4                              C# 4.0

12                           C# 4.0

2                              C# 4.0

25                           Java

Is there a way possible to perform the following query without using group by query?

select 
    Book,
    sum(Sales)
from
    Details
group by
    Book

 

I realize it is possible using Procedure, could it be done in any other way?


Updated on 28-Apr-2023
I am a content writter !

Can you answer this question?


Answer

2 Answers

Liked By