since you write columns in your SQL without qualifying which table they came from (not best practice), it's hard to figure out what you're doing, and we have to guess
for instance, i'll bet the problem is due to the fact that product_platform is actually in the tcgaz_data table, which would explain why the LEFT OUTER JOIN isn't working
here's my guess at a fix:
Code:
SELECT days.date as dt
, COUNT(tcgaz_data.date_resolved) as no
FROM days
LEFT OUTER
JOIN tcgaz_data
ON tcgaz_data.date_resolved >= days.date
AND tcgaz_data.date_resolved < days.date + INTERVAL 1 DAY
AND tcgaz_data.product_platform in ('0', 'CSP')
WHERE days.date >= CURRENT_DATE - INTERVAL 20 DAY
GROUP
BY days.date
ORDER
BY days.date
