日期:2014-05-17 浏览次数:20737 次
select *
from tb
where rq <= dateadd(day,-1,convert(varchar(10),GETDATE(),120)+' 16:00:00') --昨天16点
and rq >= dateadd(day,-2,convert(varchar(10),GETDATE(),120)+' 16:00:00') --前天16点
select * from [tablename] where rq
between
convert(varchar(10),GETDATE()-2,121)+' 16:00:00.000'
and convert(varchar(10),GETDATE()-1,121)+' 16:00:00.000'
select * from tb where rq between CONVERT (varchar(11), dateadd(dd,-2,GETDATE()),111)+' 16:00:00' and CONVERT (varchar(11), dateadd(dd,-1,GETDATE()),111)+' 16:00:00'