如何将所有记录从今天返回到将来的特定天数?
Select every record from table
where plandate = today and the next 14 days
select *
from joblist
WHERE plandate >= GETDATE() +14
答案 0 :(得分:2)
您可以这样做:(我省略声明)
set @today = GETDATE()
set @endDate = DATEADD(DAY,15,GETDATE())
SELECT your_Records from TABLE
WHERE plandate >= @today
AND plandate < @endDate
您也可以使用BETWEEN子句:
SELECT your_Records from TABLE
WHERE plandate BETWEEN @today AND @endDate
答案 1 :(得分:1)