Thanks for the reply.
Here is what I think should work. The problem is once I add the interval clause the results only include items with dates matching the Submit_Date, does not count items with a tcgaz_data_dates.Submit_Date < '2009-09-09'.
In the end the '2009-09-09' should really be the same as the interval date -
CURDATE() - INTERVAL 20 DAY, but I am not sure how the query will behave with two intervals in the same query.
Any thoughts?
Submit_Date count( * )
2009-08-23 3
2009-08-24 1
2009-08-25 1
2009-08-27 3
2009-08-31 1
2009-09-01 2
2009-09-02 3
2009-09-03 7
2009-09-04 3
2009-09-06 3
2009-09-07 7
2009-09-08 2
SELECT
tcgaz_data_dates.Submit_Date, count(*)
FROM
tcgaz_data_dates
WHERE
(tcgaz_data_dates.date_resolved >= CURDATE() - INTERVAL 20 DAY
OR (tcgaz_data_dates.date_resolved IS NULL
AND tcgaz_data_dates.Submit_Date < '2009-09-09')
)
AND tcgaz_data_dates.Submit_Date >= CURDATE() - INTERVAL 20 DAY
AND tcgaz_data_dates.product_platform in ('0', 'HPP')
AND state not in ('1AAAA', 'Duplicate', 'Failed', 'Rejected', 'Unreproducible')
GROUP BY
tcgaz_data_dates.Submit_Date