我有這樣的查詢。我想知道是否有替代品的日期內聯代碼條件?SQL Server中的日期內嵌代碼條件代碼
(p.PeriodBeginDate) <= (GETUTCDATE())
AND DATEADD("dd",180, (p.PeriodEndDate)) >= (GETUTCDATE())
下面是一個簡單的查詢
SELECT
r.ReviewRoleID, rpp.*
FROM
dbo.rev_Period_Person AS rpp
JOIN
dbo.rev_Period p ON rpp.PeriodID = p.PeriodID
LEFT JOIN
dbo.rev_Review r ON rpp.PeriodID = r.PeriodID
AND rpp.PersonID = r.RevieweePersonID
AND r.ReviewRoleID = 2
AND r.ReviewSelfAssessmentStatusID = 3
AND r.IsActive = 1
WHERE
(p.PeriodBeginDate) <= (GETUTCDATE())
AND DATEADD("dd",180, (p.PeriodEndDate)) >= (GETUTCDATE())
替代/替代:'WHERE GETUTCDATE()BETWEEN p.PeriodBeginDate AND DATEADD(DAY,180,p.PeriodEndDate)' – 2015-02-24 09:23:06