diff --git a/CRM/Export/BAO/Export.php b/CRM/Export/BAO/Export.php
index 575aa9af24cd371605850266ca71f8e0ec607566..3f0f57a3fc22b1e4d9b58684cf738e2417a49b68 100644
--- a/CRM/Export/BAO/Export.php
+++ b/CRM/Export/BAO/Export.php
@@ -438,7 +438,11 @@ VALUES $sqlValueString
 
       $relationshipJoin = $relationshipClause = '';
       if (!$selectAll && $componentTable) {
-        $relationshipJoin = " INNER JOIN {$componentTable} ctTable ON ctTable.contact_id = {$contactA}";
+        $field = 'contact_id';
+        if ($componentTable === 'civicrm_contact') {
+          $field = 'id';
+        }
+        $relationshipJoin = " INNER JOIN {$componentTable} ctTable ON ctTable.$field = {$contactA}";
       }
       elseif (!empty($relIDs)) {
         $relID = implode(',', $relIDs);