SELECT *
FROM TABLENAME
WHERE
text_date < GETDATE()
AND
text_date < DATEADD(MINUTE, 300, GETDATE())
这有什么问题吗?
答案 0 :(得分:3)
DECLARE @AddTime DATETIME
SELECT @AddTime = GETDATE();
SELECT *
FROM TABLENAME
WHERE text_date BETWEEN @AddTime AND DATEADD(HOUR, 5, @AddTime );
答案 1 :(得分:2)
试试这个 -
DECLARE @Data DATETIME
SELECT @Data = GETDATE()
SELECT *
FROM TABLENAME
WHERE text_date BETWEEN @Data AND DATEADD(MINUTE, 300, @Data)