select count(scan_time)from awhere scan_time between '2017-08-01' and '2017-08-07 12:00'and ((datepart(hour,scan_time)=1 and datepart(MINUTE,scan_time)>=15)or (datepart(hour,scan_time)>=2 and datepart(hour,scan_time)<=12))