I am very new to SQL programming, so I hope I am in the right place to get some help.
I have two tables of Data: A table full of Customer Data such as their Customer ID and their First name.
I also have a table full of order details:
When I run the following Query:
SELECT Customer.ID, CUS_FNAME, COUNT(Orders.ID) AS NUMORDS, SUM(ORD_QUANTITY) AS NUMPRODS FROM Orders JOIN Customer ON Orders.ID = Customer.ID GROUP BY Customer.ID, CUS_FNAME ORDER BY CUS_FNAME;
I get the output 'no rows selected', meaning that the query is not working.
I am trying to show a table with the Customer ID which is the same as the Orders ID, along with the number of orders and the number of products (ORD_QUANTITY) in each order.
Any help is greatly appreciated. Thank you!