title: MySQL count rows in multiple date ranges?
body: <p>I want to count the rows in several date ranges (i.e: last hour, today, this week, last 30 days) from a given table.</p>
  
  <p>I need to know how many entries are in this time/date periods to be able to tell if a given user has reach the limit for each one of this ranges. For instance, a user can have max 300 entries one month but with a (hourly/daily/weekly/monthly) limit.</p>
  
  <p>So far I'm trying with a subquery approach using a <code>SELECT CASE</code> similar to this one: <a href="https://stackoverflow.com/questions/6687534/group-by-range-in-mysql">group by range in mysql</a></p>
  
  <p>Which should be the best way of doing this?</p>