SELECT * FROM #EventOccurrence eo OUTER APPLY ( SELECT TOP 1 Grade FROM #GradeChange gc WHERE gc.id = eo.id AND gc.EffectiveDate <= eo.EventDate ORDER BY gc.EffectiveDate DESC ) gc
プレ>
SELECT * FROM #EventOccurrence eo OUTER APPLY ( SELECT TOP 1 Grade FROM #GradeChange gc WHERE gc.id = eo.id AND gc.EffectiveDate <= eo.EventDate ORDER BY gc.EffectiveDate DESC ) gc
プレ>