日期:2014-05-18 浏览次数:20392 次
select * from tb where datediff(dd,createtime,getdate()) between 1 and 10
------解决方案--------------------
datediff(dd,createtime,getdate()) between 1 and 10
------解决方案--------------------
select * from table1 where datediff(dd,getdate(),creatime) between 1 and 10
当天为4.3 -->查看4.4~4.13
------解决方案--------------------
select * from tb where date_time>=Convert(varchar(10),DATEADD(day,-11,getdate()),120) and date_time<convert(varchar(10),GETDATE(),120)
------解决方案--------------------
--前后5天,不包括当天
select * from table1 where abs(datediff(dd,creatime,getdate())) between 1 and 5
------解决方案--------------------
select *
from table1
where datediff(dd,getdate(),creatime) between 1 and 10
------解决方案--------------------
select * from table1 where datediff(day,getdate()-1,creatime)<=10
------解决方案--------------------
SELECT * FROM T WHERE creatime >= convert(varchar(10),dateadd(day,-11,getdate())
and creatime <= convert(varchar(10),getdate())