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
asked May 21 '12 at 03:15 AM in Default
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.
answered May 21 '12 at 08:52 AM