Multiplication of two colomns
My table is bellow
productId productQty productRate
1 10 100
2 20 200
3 30 300
4 40 400
5 50 500
I want @qtyRate = productQty*productRate
then sum the @qtyRate using sqlserver 2005
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Dorababu MekaRank #457 · 5.5K reputationPosted Jul 22, 2011, 1:07 AM EDT
select ProductQty, ProductRate, (ProductQty *ProductRate ) as result from tablenameDorababu MekaRank #457 · 5.5K reputationPosted Jul 22, 2011, 1:23 AM EDT
Dorababu MekaRank #457 · 5.5K reputationPosted Jul 22, 2011, 1:42 AM EDT
select
(Rate*Qty)
as qtyRate from tblName
UNION ALL
select
sum(Rate*Qty) as qtyRate from tblName
will display the multiplied results and sum of multipled resultDorababu MekaRank #457 · 5.5K reputationPosted Jul 25, 2011, 1:32 AM EDT