如何根据筛选条件生成统计结果

我创建了一张SQL表,表语句为

select md5(CONCAT(threat_dir,event_type)) as uuid, threat_dir,event_type,sum(occur_count ) as count from isop   group by threat_dir,event_type 

isop 表 有一个unix 时间戳的字段 timestamp

我如何可以设置一个筛选条件,选择timestamp 的时间范围后,动态展示过滤后的 统计结果