Galera,
I just did this query, it works great until today (day 20) minus 19, only I need it to show the last 30 days.
This works
SELECT ID, DAY( created_at ) AS DIA, SUM( 1 ) AS HORAS
FROM registration
WHERE created_at
BETWEEN CURRENT_DATE( ) -19
AND CURRENT_DATE( )
GROUP BY DAY( created_at )
ORDER BY DAY( created_at )
This returns the wrong amount
SELECT ID, DAY( created_at ) AS DIA, SUM( 1 ) AS HORAS
FROM registration
WHERE created_at
BETWEEN CURRENT_DATE( ) -30
AND CURRENT_DATE( )
GROUP BY DAY( created_at )
ORDER BY DAY( created_at )