Skip to content
Advertisement

Get total Sum from SQL Query of two tables

I have two tables which are as follows:

Table1 and Table2.

Table1 :

Table2:

I want a SQL query which would show me the result in total manner. The Output that I want is :

I have done it using the PowerBI and I know it can be done using SQL too but I am not able to achieve it. I have prepared the table to learn the query. Also it would be amazing if I get to know how powerBI Measure can be different from SQL query, or are they same?

Thanks in Advance.

Advertisement

Answer

I don’t see how these sums are cumulative. Presumably, you just want aggregation and regular sums:

Note that group is a language keyword, hence a poor choice for a column name. I renamed it to grp in the query.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement