This should be a very simple code, but I can’t figure it out. Basically I want to JOIN two tables. One of the tables has the name of the user and the other table has all the orders that
that user submitted. I want a list of all the users, ORDERED by the user who has submitted the most orders. Is this possible using JOIN?
SELECT COUNT(table1.Orders)
, table2.Name
FROM table1
LEFT JOIN table2 ON table1.IDName = table1.IDName
ORDER BY COUNT(table1.Orders)
This is the code I have right now. Thanks for taking a look at this, I look forward to hearing your responses.
You probably need to use
GROUP BYand sort by decreasing order. YourJOINis wrong, I replacedtable1.IDNamewithtable2.IDName: