title: How to select highest count in Access query?
body: <p>My Access database table ITEM has 2 columns: ITEMID and CATEGORY. </p>
  
  <pre><code>ITEMID  CATEGORY
  I01 C01
  I02 C02
  I03 C01
  I04 C02
  I05 C03
  </code></pre>
  
  <p>I want to do a query that select the category of item having maximum number of items.
  I wrote the query as follows:</p>
  
  <pre><code>SELECT TOP 1 ITEM.CATEGORY
  FROM ITEM
  GROUP BY ITEM.CATEGORY
  ORDER BY COUNT(ITEM.ITEMID) DESC;
  </code></pre>
  
  <p>The result comes as:</p>
  
  <pre><code>CATEGORY
  C02
  C01
  </code></pre>
  
  <p>Another version of the query (using nested approach) as follows:</p>
  
  <pre><code>SELECT ITEM.CATEGORY
  FROM ITEM
  GROUP BY ITEM.CATEGORY
  HAVING COUNT(*)=
  (SELECT MAX(TBL2.CNT2) 
  FROM 
  (SELECT COUNT(*) AS CNT2
  FROM ITEM
  GROUP BY ITEM.CATEGORY) AS TBL2);
  </code></pre>
  
  <p>The result comes as:</p>
  
  <pre><code>CATEGORY
  C01
  C02
  </code></pre>
  
  <p>Note that both the queries return same results, but with different ordering: first one returns C02 and then C01, while second one returns C01, C02</p>
  
  <p>Please comment. Any better alternative?</p>