I want to get the data every day within one year backward but I have to use 365 queries for each day like:
for ($i = 0; $i<365; $i++){
$end_day = ...; // the end time of each day
$start_day = ...; // the start time of each day
$query = select count(*)....where created < $end_day AND created > $start_day
}
I think that my current solution makes the system very slow. Is there any way to just use one query only?