Calculate the total cost of products

So I have a product table. Each product has a price (decimal) and a quantity (int).

I need to be able to calculate the total cost / value of all products in stock. So, multiply each product price by the quantity, and then add everything together.

I wonder if anyone can help me with this.

Thanks.

+4
source share
1 answer
select sum(price*quantity) as yoursum from yourtable 
+4
source

All Articles