--如果还有今天以后的数据
--一周内呢
SELECT * FROM TB WHERE datediff(dd,DATE_TIME,getdate()) between 0 and 7
--从现在起往前算24小时内的呢?
SELECT * FROM TB WHERE datediff(hh,DATE_TIME,getdate()) between 0 and 23
时间: 2024-10-21 14:38:49
--如果还有今天以后的数据
--一周内呢
SELECT * FROM TB WHERE datediff(dd,DATE_TIME,getdate()) between 0 and 7
--从现在起往前算24小时内的呢?
SELECT * FROM TB WHERE datediff(hh,DATE_TIME,getdate()) between 0 and 23