I have a CASE statement within an ON clause:
CASE
ON
ON A.month = CASE WHEN (B.month = GREATEST(B.month)) THEN B.month - 1