title: How can I select the max counted values from that was 'GROUP BY' twice?
body: <p>Sorry for the bad title, I need to improve on how to explain my problem better, obviously.
  I'm practicing queries on the Adventure Works data in SQL server, and I queried such as:</p>
  <pre><code>SELECT a.City, pc.Name, COUNT(pc.Name) AS 'Count'
  FROM SalesLT.SalesOrderHeader AS oh
  JOIN SalesLT.SalesOrderDetail AS od ON oh.SalesOrderID = oh.SalesOrderID
  JOIN SalesLT.Product AS p ON od.ProductID = p.ProductID
  JOIN SalesLT.ProductCategory AS pc ON p.ProductCategoryID = pc.ProductCategoryID
  JOIN SalesLT.Address AS a ON oh.ShipToAddressID = a.AddressID
  GROUP BY a.City, pc.Name
  ORDER BY a.City;
  </code></pre>
  <p>Which gives:</p>
  <pre><code>City          Name   Count
  ----         ------  ------
  Abingdon    Cleaners    7
  Abingdon    Vests      16
  Abingdon    Pedals     29
  Alhambra    Jersey     44
  Alhambra    Vests      16
  Auburn  Hydration Packs 7
  Auburn  Derailleurs     8
  </code></pre>
  <p>And I'm trying to only get the largest count item, expected output looks like this:</p>
  <pre><code>City          Name   Count
  ----         ------  ------
  Abingdon    Pedals     29
  Alhambra    Jersey     44
  Auburn  Derailleurs     8
  </code></pre>
  <p>The max count for each city. Since I don't have a sample dataset, so I'm not asking for the exact query, but can you give me some idea of what I should look into? I've been trying different 'group by's, but I always end up getting this far, but I can never move forward.
  <br><br>
  Also, the question was &quot;Identify the three most important cities. Show the break down of top-level product category against the city.&quot;, if possible, can you please share how you would approach this problem? I've been trying to improve my SQL skills, but I have a hard time writing a complex query. It would be greatly appreciated if you can share a tip to approach complex queries.
  <br><br>
  Any guidance on how I should approach this problem would be appreciated.</p>