我有这样的查询。我想知道日期内联代码条件是否有替代品?
(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())
答案 0 :(得分:1)
其中GETUTCDATE()在(p.PeriodBeginDate)和DATEADD之间(&#34; dd&#34;,180,(p.PeriodEndDate))