doubleplusgood
doubleplusgood

Reputation: 2556

Calculate Total Value of Products

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

I need to be able to calculate the total price/value of all products in stock. So, multiple each product's price by the quantity and then add them all together.

Wondered if anyone might be able to help me with this.

Thanks.

Upvotes: 4

Views: 3020

Answers (1)

Giku Promitt
Giku Promitt

Reputation: 610

select sum(price*quantity) as yoursum from yourtable

Upvotes: 4

Related Questions