title: MySQL: count data with a range
body: <p>I'm using below query to count the daily result, but now I'm make it short just show data result in <code>2012-06-01</code>.</p>
  
  <pre><code>SELECT DATE(A.Inspection_datetime) AS Date,A.Line,
         TRIM(A.Model) AS Model, A.Lot_no, COUNT(A.Serial_number) AS Qty,
         B.name
  FROM inspection_report AS A
  LEFT JOIN Employee AS B
  ON A.NIK=B.NIK
  WHERE A.Inspection_datetime LIKE '2012-06-01%'
  GROUP BY DATE(A.Inspection_datetime), TRIM(A.Model), B.name,A.Line,A.Lot_no
  </code></pre>
  
  <p>I got result like : </p>
  
  <pre><code>Date        Line       Model        Lot_no  Qty name
  2012-06-01  FA 24   DDX6051BTQD     014A    4   Ben
  2012-06-01  FA 24   DDX6051BTQD     014A    4   August
  2012-06-01  FA 24   DDX630WBTXD     012A    8   August
  2012-06-01  FA 17   KD-DV5506UPD    021A    20  Stue
  2012-06-01  FA 17   KD-DV5606UD     114A    25  Carl
  2012-06-01  FA 17   KD-DV5606UD     114A    3   Teo
  </code></pre>
  
  <p>How to do if I want to count data until target  data ex. count from <code>DDX6051BTQD</code> until <code>KD-DV5506UPD</code>. So, I'm just get the result LIKE :</p>
  
  <pre><code>Date          Qty
  2012-06-01    36
  </code></pre>
  
  <p>Try:</p>
  
  <pre><code>SELECT X.DATE, SUM(X.Qty) FROM (//insert query above//)
  WHERE ??????? //how to do ?
  </code></pre>