I want to collect data from SQL from the last 30 days. This code shows data of all time
$result = $dbh->query('SELECT country,COUNT(*) FROM data_able GROUP BY country');
this shows nothing, instead of showing last 30 days data.
$result = $dbh->query('SELECT country,COUNT(*) FROM data_able GROUP BY country WHERE dtime > DATE_SUB(CURDATE(), INTERVAL 30 DAY)');
All SQL entries were made within the last 30 days. also tried
$result = $dbh->query('SELECT country,COUNT(*) FROM data_able WHERE dtime > DATE_SUB(CURDATE(), INTERVAL 30 DAY) GROUP BY country');
What am I doing wrong here ?