3
SELECT *
FROM TABLENAME
WHERE 
       text_date < GETDATE()
     AND 
       text_date < DATEADD(MINUTE, 300, GETDATE())

这有什么问题吗?

4

2 回答 2

3
 DECLARE @AddTime DATETIME
  SELECT @AddTime = GETDATE();

 SELECT *
  FROM TABLENAME
 WHERE text_date BETWEEN @AddTime AND DATEADD(HOUR, 5, @AddTime );

参考

于 2013-07-22T07:41:31.353 回答
2

试试这个——

DECLARE @Data DATETIME
SELECT @Data = GETDATE()

SELECT *
FROM TABLENAME
WHERE text_date BETWEEN @Data AND DATEADD(MINUTE, 300, @Data)
于 2013-07-22T07:38:51.023 回答