|
I have a table with the below columns: Customer_Id, Product_Id, Product_Name, Unit_Price, Quantity I need to find the number of distinct products the customer has purchased and the total cost of the products (which is Unit_Price * quantity). I should get the below 3 columns as the result: Customer_Id Product_Id Total_Price
(comments are locked)
|
|
you can use SUM Product_Id and GROUP BY Product_Id to find a total amount of product and than multiply with Unit_price, that's all you have to do. But I also need the customer_Id column. When I use "group by", I cannot select customer_Id as a column. Please help...
May 21 '12 at 11:56 AM
Shanthi
Yes you can, but you have to GROUP BY also customer_Id
May 21 '12 at 12:43 PM
Gogolo
(comments are locked)
|

