title: SELECT wn_sum,COUNT(*) as count FROM cash_numbers GROUP BY wn_sum ORDER BY wn_sum ASC; limit search
body: <p>I have the following SQL statement:</p>
  
  <pre><code>SELECT wn_sum, COUNT(*) as count FROM cash_numbers GROUP BY wn_sum ORDER BY wn_sum ASC;
  </code></pre>
  
  <p>which does pretty much what I want but I like to select 1st 100 rows from <code>wn_sum</code>, or last 100 rows from <code>wn_sum</code>.</p>
  
  <p>How would I rewrite this statement to only get first 100 rows from <code>wn_sum</code> or last 100 rows from <code>wn_sum</code> to get my counts?</p>
  
  <pre><code>mysql&gt; SELECT wn_sum, COUNT(*) as count FROM cash_numbers GROUP BY wn_sum ORDER BY wn_sum ASC;
  
  +--------+-------+
  | wn_sum | count |
  +--------+-------+
  |     54 |     2 |
  |     56 |     1 |
  |     61 |     1 |
  |     65 |     1 |
  |     66 |     1 |
  |     68 |     1 |
  |     70 |     1 |
  |     71 |     1 |
  |     72 |     1 |
  |     73 |     2 |
  |     76 |     4 |
  ....
  |    234 |     1 |
  |    237 |     1 |
  |    241 |     1 |
  |    244 |     1 |
  |    251 |     2 |
  |    267 |     1 |
  +--------+-------+
  156 rows in set (0.00 sec)
  
  mysql&gt; 
  </code></pre>
  
  <p>I did try to put limit 100, but my syntax is wrong so I get errors when I try to use those limits.</p>