Posted on: 10/8/2013 10:13:16 PM | Views : 572

All,
I have seen some similar MAX(COUNT) questions, but the one I am dealing with is slightly different and I have been unable to use the other responses to solve my problem.
This is using the AdventureWorks2012 database (it is a free database used for school).  I have one table (Sales.SalesOrderHeader) that contains the SalesOrderNumber and ShipToAddressID.  In another table (Person.Address) I have the AddressID (which is the Primary Key and matches up with the ShipToAddressID) and the City.
What I need to do is to find the City with the highest COUNT of orders.  So I need to COUNT the SalesOrderNumber group that by the ShipToAddressID from the SalesSalesOrderHeader, then connect that ShipToAddressID to the AddressID and City in the Person.Address table.
I have managed to find the following sub-query that gets me started, but I don't know how to link it to the information in the Person.Address table (AddressID and City).
Selec ...

Go to the complete details ...