Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 stuck on a tricky query

Author  Topic 

masterdineen
Aged Yak Warrior

550 Posts

Posted - 2009-11-01 : 18:24:55
Hello

I have an orders table with OrderID productID Quantity unitPrice and totalPrice

there are many orders of the same ProductID. BUT i want to extract is how much we have made on each Product in one result

can someone point me in the right direction please

Regards

Rob

MCTS certified

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-11-02 : 00:59:12
[code]
SELECT productID, Sum(Quantity * UnitPrice)
FROM Orders
GROUP BY
productID[/code]
Go to Top of Page

masterdineen
Aged Yak Warrior

550 Posts

Posted - 2009-11-02 : 03:09:53
wow, as easy as that

thank you for you help Russell

Regards

Rob

MCTS certified
Go to Top of Page
   

- Advertisement -