I write a query to multiply to colums now i would like to sum up the result that i am getting can any one give me an idea
this is what i wrote
select Rate,Qty,(Rate*Qty) as result
from tblName
I will get result say for example 40 90
now i would like to sum these results
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With