SELECT DISTINCT
VEEMS_CREATED_DATE
FROM
VEEMS_SHIP_STATE_DATA
WHERE
VEEMS_CREATED_DATE <= DATEADD(day,-7, GETDATE())
ORDER BY
VEEMS_CREATED_DATE
答案 0 :(得分:0)
直接从getdate()
SELECT DISTINCT VEEMS_CREATED_DATE
FROM VEEMS_SHIP_STATE_DATA
WHERE VEEMS_CREATED_DATE <= **GETDATE() - 7**
ORDER BY VEEMS_CREATED_DATE
答案 1 :(得分:0)
另一种方法是使用DATEDIFF
WHERE DATEDIFF(day,VEEMS_CREATED_DATE,GETDATE()) between 0 and 7
答案 2 :(得分:0)
SELECT * FROM table WHERE Datetime BETWEEN (CURDATE() - INTERVAL 7 DAY)