Trying to do an SQL statement, but I can't figure it out. I need to find which product has the highest overall sales and which has the lowest overall sales.
I have these columns to work from
PRODUCT
ProductID, ProductName
ORDER
OrderID, Itemid, ProductID, Price, QTY, Itemtotal
(Its from the Oracle test database)
(Where itemtotal is qty x price)
basically I need to find a the sum of itemtotal, and the min and max of it and reference that back to the product ID, but I have no clue how. All I know is I need two subqueries
I have these columns to work from
PRODUCT
ProductID, ProductName
ORDER
OrderID, Itemid, ProductID, Price, QTY, Itemtotal
(Its from the Oracle test database)
(Where itemtotal is qty x price)
basically I need to find a the sum of itemtotal, and the min and max of it and reference that back to the product ID, but I have no clue how. All I know is I need two subqueries