Select Count (case when)!
I can share the conceptual answer to this problem, you will have to fill in correct syntax for query as per your database engine.

select record, count(record)
from table
where datetime is interval of 12 hours from now
group by record


This query can give you record occurrences in one single interval of time.

select record, 
   SUM(case when datetime is in interval 12h then 1 else 0 end) 12_hour_occurrence,
   SUM(case when datetime is in interval 24h then 1 else 0 end) 24_hour_occurrence,
   SUM(case when datetime is in interval 72h then 1 else 0 end) 72_hour_occurrence
from table
where datetime &gt; now() - 72 hours # don't pass thorugh extra records
group by record


For running on single query on multiple instances, you can use this concept to find occurrences in multiple intervals.