return query.join(
            models.CandidateElection,
            sa.and_(
                models.CandidateHistory.candidate_id == models.CandidateElection.candidate_id,
                models.CandidateHistory.two_year_period <= models.CandidateElection.cand_election_year,