I have the following two SQL statements:SELECT Customer_ID, Count(Customer_ID) As [Number of Purchases]FROM OrdersGroup By Customer_ID;SELECT Order_Number, Sum(Quantity * Price) As [Purchase Total]FROM Order_DetailGroup By Order_Number;
Both of these execute correctly but now I'm trying to combine both of them to be able to return 1)Customer_ID, 2)[Number of Purchases], 3)Order_number and 4)[Purchase Total]. I tried combining them like this:SELECT Customer_ID, o.Order_Number, Count(Customer_ID) As [Number of Purchases], Sum(Quantity * Price) As [Purchase Total]FROM Orders o, Order_Detail odWhere o.Order_Number = od.Order_NumberGroup By Customer_ID, o.Order_Number;
The results, however, are not correct so this is what I need help on. Any help is appreciated. Thanks!