Ibrahim Azhar Armar
Ibrahim Azhar Armar

Reputation: 25745

Calculating all values in column

I have a table order_product

enter image description here

i want to calculate all the values from cost column and quantity column WHERE order_orderNumber = 1100

how do i do it.?

Upvotes: 0

Views: 84

Answers (1)

Sarfraz
Sarfraz

Reputation: 382726

If you meant sum, you can do:

SELECT product_id, SUM(quantity) AS totalQuantity, SUM(cost) AS totalCost
FROM order_product WHERE order_orderNumber = 1100
GROUP BY product_id

Upvotes: 1

Related Questions