我正在使用这个
DECLARE @Year_Filter_Start AS DATETIME
SET @Year_Filter_Start = DATEADD( dd, -1, DATEADD( yy, DATEDIFF( yy, 0, GetDate() ), 0 ) )
DECLARE @Year_Filter_End AS DATETIME
SET @Year_Filter_End = GetDate()
INSERT INTO TABLE
( blah )
SELECT blah
FROM OTHER_TABLE
WHERE ACTISSUEDATE IS NULL
OR ACTSTARTDATE BETWEEN @Year_Filter_Start AND @Year_Filter_End
它返回 ACTISSUEDATE 不为空且 ACTSTARTDATE 不在年初和今天之间的记录。@Year_Filter_Start 应该是今年年初,@Year_Filter_End 应该是今天。
例如:
ACTSTARTDATE 为 2010-08-02 且 ACTISSUEDATE 为 2011-03-15 的记录
或者 ACTSTARTDATE 是 2009-05-18 并且 ACTISSUEDATE 是 2009-09-06
这个说法有问题吗?