Цените помощь, которую мне оказали. Мне удалось ответить на мой собственный вопрос. Я нашел пример этого решения из другого вопроса. Я изменил это, чтобы соответствовать моему собственному.
SELECT distinct
RRP.Id, RRP.UniqClient, RRP.Client, RRP.Expiring_Policies, RRP.UniqBroker, CONVERT(varchar, RRP.ExpDate, 101) AS ExpDate,
RRP.NewUw, RRP.OtherContact, RRP.Company, RRP.Broker_Name, RRP.Reviewed, RRP.DateCreated,
RRP.DateUpdated, RRP.EmailCreated, RRP.UniqProducer, RRP.LINES, CASE WHEN MMS.UniqMarketingSubmission IS NULL THEN 'No' ELSE 'Yes' END AS [MMS Created]
FROM dbo.Reviewed_Renewal_Policy AS RRP LEFT OUTER JOIN
GREEN43_PROD_REPL.dbo.MarketingSubmission AS MMS ON RRP.UniqClient = MMS.UniqEntity AND RRP.ExpDate = MMS.EffectiveDate
where ((RRP.Reviewed = 'No') AND (DATENAME(month, RRP.ExpDate) = DATENAME(MONTH, DATEADD(Month, 4, GETDATE())))
AND Month(getdate()) <= Month(RRP.ExpDate))
OR
((RRP.Reviewed = 'No') AND (DATENAME(month, RRP.ExpDate) = DATENAME(MONTH, DATEADD(Month, 4, GETDATE())))
AND Month(getdate()) > Month(RRP.ExpDate) AND Year(RRP.ExpDate) > Year(getdate()))
order by ExpDate ASC
Возвращает значения текущего года и значения следующего года, когда сделан соответствующий выбор.
ИЛИ Альтернатива благодаря Гордону Линоффу выше
SELECT distinct
RRP.Id, RRP.UniqClient, RRP.Client, RRP.Expiring_Policies, RRP.UniqBroker, CONVERT(varchar, RRP.ExpDate, 101) AS ExpDate,
RRP.NewUw, RRP.OtherContact, RRP.Company, RRP.Broker_Name, RRP.Reviewed, RRP.DateCreated,
RRP.DateUpdated, RRP.EmailCreated, RRP.UniqProducer, RRP.LINES, CASE WHEN MMS.UniqMarketingSubmission IS NULL THEN 'No' ELSE 'Yes' END AS [MMS Created]
FROM dbo.Reviewed_Renewal_Policy AS RRP LEFT OUTER JOIN
GREEN43_PROD_REPL.dbo.MarketingSubmission AS MMS ON RRP.UniqClient = MMS.UniqEntity AND RRP.ExpDate = MMS.EffectiveDate
where ((RRP.Reviewed = 'No') AND (DATENAME(month, RRP.ExpDate) = DATENAME(MONTH, DATEADD(Month, 3, GETDATE())))
AND Month(getdate()) <= Month(RRP.ExpDate))
OR
((RRP.Reviewed = 'No') AND (DATENAME(month, RRP.ExpDate) = DATENAME(MONTH, DATEADD(Month, 3, GETDATE()))) AND
datefromparts(1 + year(getdate()), 1, 1) <= RRP.ExpDate and datefromparts(1 + year(getdate()), 2, 1) >= RRP.ExpDate)
order by ExpDate ASC