select * from tb where datepart(weekday, CheckTime)=4 and hour(CheckTime)=8 and CheckTime > dateadd(day,-30,now()); select * from tb where datepart(weekday, CheckTime)=4 and hour(CheckTime)=8 and CheckTime > dateadd(day,-90,now()); select * from tb where datepart(weekday, CheckTime)=4 and hour(CheckTime)=8 and CheckTime > dateadd(day,-365,now());
from tb
where datepart(weekday, CheckTime)=4 and hour(CheckTime)=8 and CheckTime > dateadd(day,-30,now());
select *
from tb
where datepart(weekday, CheckTime)=4 and hour(CheckTime)=8 and CheckTime > dateadd(day,-90,now()); select *
from tb
where datepart(weekday, CheckTime)=4 and hour(CheckTime)=8 and CheckTime > dateadd(day,-365,now());