- 1
What is the number of items placed for the 8th person on this list?
I have a set of data in tables consisting of ER diagrams and there are relationships between them and some of them Table of invoices and customers and asked me the following: Run Query: Show the number of orders placed by each customer (hint: this is found in the invoices table) and sort the result by the number of orders in descending order. Then What is the number of items placed for the 8th person on this list? Can anyone help me to write the code?
6 Answers
0
Something Simple i hope you will orient
SELECT c.CustomerID,c.CustomerName, COUNT(o.CustomerID) NumberOfOrders FROM Customers c
JOIN Orders o ON o.CustomerID = c.CustomerID
GROUP BY o.CustomerID
ORDER BY NumberOfOrders DESC
0
And when you want only the 8th person from this generated list add this for end on previous query LIMIT 1 OFFSET 7
0
But i don't have a column called NumberOfOrdera
So the main problem i don't know which column i should use for the number of orders
0
PM me and give me the names of columns in table of customers and names of colums in table of invoices and then i will write you a completely finished query
0
What is the mean of PM me ?
Do You mean chatting you?
0
Yes pm private message