title: MySQL Count Numbers Are Off
body: <p>I am not sure why my numbers are drastically off from each other.</p>
  
  <p>A query with no max id:</p>
  
  <pre><code>SELECT id, DATE_FORMAT(t_stamp, '%Y-%m-%d %H:00:00') as date, COUNT(*) as count
  FROM test_ips
  WHERE id &gt; 0
  AND viewip != ""
  GROUP BY HOUR(t_stamp)
  ORDER BY t_stamp ASC;
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>1     2012-07-18 19:00:00     1313
  106     2012-07-18 20:00:00     1567
  107     2012-07-19 09:00:00     847
  225     2012-07-19 10:00:00     5095
  421     2012-07-19 11:00:00     205
  423     2012-07-19 12:00:00     900
  461     2012-07-19 13:00:00     619
  490     2012-07-20 15:00:00     729
  575     2012-07-20 16:00:00     1682
  1060     2012-07-20 17:00:00     2063
  2260     2012-07-20 18:00:00     1417
  5859     2012-07-20 21:00:00     1303
  7060     2012-07-20 22:00:00     1340
  8280     2012-07-20 23:00:00     1211
  9149     2012-07-21 00:00:00     1675
  10418     2012-07-21 01:00:00     721
  11127     2012-07-21 02:00:00     825
  </code></pre>
  
  <p>But if I add a max id:</p>
  
  <pre><code>AND id &lt;= 8279
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>1     2012-07-18 19:00:00     1313
  106     2012-07-18 20:00:00     1201
  107     2012-07-19 09:00:00     118
  225     2012-07-19 10:00:00     196
  421     2012-07-19 11:00:00     2
  423     2012-07-19 12:00:00     38
  461     2012-07-19 13:00:00     20
  490     2012-07-20 15:00:00     85
  575     2012-07-20 16:00:00     483
  1060     2012-07-20 17:00:00     1200
  2260     2012-07-20 18:00:00     1200
  5859     2012-07-20 21:00:00     1201
  7060     2012-07-20 22:00:00     1220
  </code></pre>
  
  <p>The numbers are WAY off from each other.  Something is goofy.</p>
  
  <p>EDIT: Here is my table structure:</p>
  
  <pre><code>id  t_stamp             bID      viewip                 unique
  1   2012-07-18 19:22:20     5    192.168.1.1        1
  2   2012-07-18 19:22:21     1    192.168.1.1        1
  3   2012-07-18 19:22:22     5    192.168.1.1        0
  4   2012-07-18 19:22:22     3    192.168.1.1        1
  </code></pre>