--如果还有今天以后的数据
--一周内呢
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-12-25 21:19:42
--如果还有今天以后的数据
--一周内呢
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