在表中有一个日期型字段,如何根据该字段找到系统当前时间的前20分钟的数据.
------解决方案--------------------------------------------------------
datediff(mi,字段,20)> 0
------解决方案--------------------------------------------------------
SELECT * FROM 表 WHERE 日期 <=datediff(mi,-20,getdate())
------解决方案--------------------------------------------------------
select * from table1 where datediff(minute,datecolumn,getdate())> 20
------解决方案--------------------------------------------------------
汗 应该是小于
select * from table1 where datediff(minute,datecolumn,getdate()) <20
------解决方案--------------------------------------------------------
where datediff(n,字段,getdate()) <= 20