title: LIMIT before DISTINCT
body: <pre><code>SELECT DISTINCT no, COUNT(*) AS TOTAL 
  FROM ar_test 
  GROUP BY no 
  ORDER BY TOTAL DESC
  </code></pre>
  
  <p>This code works fine <br></p>
  
  <p>So I have this column <code>no</code> and it holds numbers from 0 to 36
  And I have a lot of rows. So this SQL groups them in single 0, 1, 2, 3, 4 .... 36 and in <code>TOTAL</code> gives me the count of every 0 to 36 number. It looks like this : <br><br>
  0 - is 40 times in the table <br>
  1 - is 35 times <br>
  2 - 15 <br>
  3 - 14 etc... <br>
  This code counts all my rows. <br></p>
  
  <p>So I need to add limit, I want to count the last 100 rows only and check it out their count. <br>
  If I add <code>LIMIT 7</code> at the end of my SQL code for example. It won't work that way cuz it will give me the count from number 0 to 6...
  First I need to select (limit) the last 7 rows, and after that to use my type of code and count them.</p>