//used when contribution field is selected
if ($this->_contribField) {
$this->_from .= "
- LEFT JOIN (
- SELECT cc.*, cmp.membership_id as membership_id
- FROM civicrm_membership_payment cmp
- JOIN civicrm_contribution cc
- ON cc.id = cmp.contribution_id
- ORDER BY cc.receive_date DESC
- ) {$this->_aliases['civicrm_contribution']}
- ON {$this->_aliases['civicrm_membership']}.id =
- {$this->_aliases['civicrm_contribution']}.membership_id\n";
+ LEFT JOIN civicrm_membership_payment cmp
+ ON {$this->_aliases['civicrm_membership']}.id = cmp.membership_id
+ LEFT JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
+ ON cmp.contribution_id={$this->_aliases['civicrm_contribution']}.id\n";
}
}