*/
public function processContacts($processGeocode, $parseStreetAddress) {
// build where clause.
- $clause = ['( c.id = a.contact_id )'];
+ $clause = [];
$params = [];
if ($this->start) {
$clause[] = "( c.id >= %1 )";
$whereClause = implode(' AND ', $clause);
$query = "
- SELECT c.id,
- a.id as address_id,
- a.street_address,
- a.city,
- a.postal_code,
- a.country_id,
- s.name as state,
- o.name as country
- FROM civicrm_contact c
- INNER JOIN civicrm_address a ON a.contact_id = c.id
- LEFT JOIN civicrm_country o ON a.country_id = o.id
- LEFT JOIN civicrm_state_province s ON a.state_province_id = s.id
- WHERE {$whereClause}
+ SELECT c.id,
+ a.id as address_id,
+ a.street_address,
+ a.city,
+ a.postal_code,
+ a.country_id,
+ s.name as state,
+ o.name as country
+ FROM civicrm_address a
+ LEFT JOIN civicrm_contact c
+ ON a.contact_id = c.id
+ LEFT JOIN civicrm_country o
+ ON a.country_id = o.id
+ LEFT JOIN civicrm_state_province s
+ ON a.state_province_id = s.id
+ WHERE {$whereClause}
ORDER BY a.id
";