INNER JOIN civicrm_pledge {$this->_aliases['civicrm_pledge']}
ON ({$this->_aliases['civicrm_pledge']}.contact_id =
{$this->_aliases['civicrm_contact']}.id) AND
- {$this->_aliases['civicrm_pledge']}.status_id IN ( {$statusIds} )
- LEFT JOIN ";
+ {$this->_aliases['civicrm_pledge']}.status_id IN ( {$statusIds} )\n";
// Note that the derived query protects us from providing inaccurate data in the edge case where pledge
// payments have been edited such that they are not in id order. This might be better as a temp table.
- $this->_from .= "(SELECT * FROM civicrm_pledge_payment ORDER BY scheduled_date) as {$this->_aliases['civicrm_pledge_payment']}
+ $this->_from .= "LEFT JOIN (SELECT * FROM civicrm_pledge_payment ORDER BY scheduled_date) as {$this->_aliases['civicrm_pledge_payment']}
ON ({$this->_aliases['civicrm_pledge']}.id =
{$this->_aliases['civicrm_pledge_payment']}.pledge_id AND {$this->_aliases['civicrm_pledge_payment']}.status_id = {$pendingStatus} ) ";