Multiply 2 columns in sql and summarize all results with SQL

I am writing a query to multiply by colums, now I would like to summarize what I get, can someone give me an idea

here is what i wrote

select Rate,Qty,(Rate*Qty) as result from tblName

I will get a result, say, for example 40 90 , now I would like to summarize these results

+4
source share
2 answers

Original answer

 select Sum(Rate) as Rate, Sum(Qty) as Qty, Sum(Rate*Qty) as Result from tblName 

EDIT - try this.

 select 0 as TotalRow, Rate, Qty, (Rate*Qty) as Result from tblName UNION ALL select 1 as TotalRow, Sum(Rate) as Rate, Sum(Qty) as Qty, Sum(Rate*Qty) as Result from tblName Order By TotalRow 
+8
source
 SELECT SUM(Rate*Qty) as Result FROM tblName 
+3
source

All Articles