SQL Query - Sum of Order tha Contain an Item
I am surprised I have not been able to find a solution to this. We have a
table
ORDER # | PRODUCT ID | PRICE
1 | 1 | 1.00
1 | 2 | 2.00
2 | 3 | 3.00
2 | 4 | 4.00
3 | 1 | 5.00
3 | 4 | 6.00
We want to capture the sum of the revenues of all orders which included
productID=1. The result in this example should be 1+2+5+6 = 14
What is the best way to achieve this?
Thanks!
No comments:
Post a Comment