title: MySQL filter on step
body: <p>I have a table </p>
  
  <pre><code>create table
  (
   col1 int,
   nr   int
  );
  
  insert into table (col1, nr) values (1, 1);
  insert into table (col1, nr) values (2, 1);
  insert into table (col1, nr) values (3, 1);
  
  insert into table (col1, nr) values (10, 2);
  insert into table (col1, nr) values (208, 2);
  
  insert into table (col1, nr) values (356, 3);
  
  ... 
  
  insert into table (col1, nr) values (43, 10000);
  insert into table (col1, nr) values (34, 10000);
  </code></pre>
  
  <p>According to this example the max(nr) = 10000. How to have query that will filter the data in above table in the following way:</p>
  
  <pre><code>count on (col1) for nr between 1 and 20, the 20 is the step
  count on (col1) for nr between 21 and 40
  count on (col1) for nr between 41 and 60
  ...
  count on (col1) for nr between X and 10000
  </code></pre>
  
  <p><strong>This is what I need, thanks:</strong></p>
  
  <pre><code>select 
  rownum,
  ((rownum -1) * 100) + 1 as p_nr_token_start,
  rownum * 100 as p_nr_token_end
  from (
  select 
   @rn:=@rn+1 as rownum
  from information_schema.columns a,
  (select @rn:=0) b) rr
  where (rownum * 100) &lt;= 100000
  </code></pre>