I need to make ten selections. One of all the datetimes in the last 24 hours, the next one from 24 hours to 48 hours, and on back in 24 hour blocks for the last ten days. I've tried various approaches to this, but this is what I currently have:
select title, app_id, count(*) as cnt from app_instances where time between now() -1 day and now()-2 day group by title order by cnt desc
The best way I can think of is to run these queries inside a for loop, substituting out the numbers for incremental variables in PHP to result in 10 seperate selections. Does anyone know the correct syntax for this or maybe have a better way?