SELECT *
FROM TABLENAME
WHERE
text_date < GETDATE()
AND
text_date < DATEADD(MINUTE, 300, GETDATE())
這是否有問題?如何檢索sql中的下一個5小時數據表
SELECT *
FROM TABLENAME
WHERE
text_date < GETDATE()
AND
text_date < DATEADD(MINUTE, 300, GETDATE())
這是否有問題?如何檢索sql中的下一個5小時數據表
嘗試這一個 -
DECLARE @Data DATETIME
SELECT @Data = GETDATE()
SELECT *
FROM TABLENAME
WHERE text_date BETWEEN @Data AND DATEADD(MINUTE, 300, @Data)
感謝哥們! –
不客氣@Vikas Hooda :) – Devart
DECLARE @AddTime DATETIME
SELECT @AddTime = GETDATE();
SELECT *
FROM TABLENAME
WHERE text_date BETWEEN @AddTime AND DATEADD(HOUR, 5, @AddTime);
SELECT * FROM TABLENAME其中 text_date> = GETDATE()和 text_date