MySQL: count data from A month until B month
regarding to this question, i have a problem if use that query for count some data. How to make it can count data for ex. from 2010-01 until 2010-05?
after use that 开发者_如何转开发query the show as null. this is my query:
SELECT id, Line, COUNT( Serial_number ) AS Qty,
SUM(S), SUM(A), SUM(B), SUM(C),
(SUM( S ) + SUM( A ) + SUM( B ) * 0.4 + SUM( C ) * 0.1) / COUNT( Serial_number ) AS QP
FROM `inspection_report`
SELECT id, Line, COUNT( Serial_number ) AS Qty,
SUM(S), SUM(A), SUM(B), SUM(C),
(SUM( S ) + SUM( A ) + SUM( B ) * 0.4 + SUM( C ) * 0.1) / COUNT( Serial_number ) AS QP
FROM `inspection_report`
WHERE `thedate` BETWEEN '2010-01-01' AND '2010-06-00'
精彩评论