diff --git a/plugins/selection/EntityReference_SelectionHandler_Generic.class.php b/plugins/selection/EntityReference_SelectionHandler_Generic.class.php
index 2d1c5d7..170f13b 100644
--- a/plugins/selection/EntityReference_SelectionHandler_Generic.class.php
+++ b/plugins/selection/EntityReference_SelectionHandler_Generic.class.php
@@ -340,7 +340,7 @@ class EntityReference_SelectionHandler_Generic implements EntityReference_Select
     $entity_info = entity_get_info($target_type);
     $id = $entity_info['entity keys']['id'];
     // Return the alias of the table.
-    return $query->innerJoin($target_type, NULL, "$target_type.$id = $alias.entity_id");
+    return $query->innerJoin($target_type, NULL, "%alias.$id = $alias.entity_id");
   }
 }
 
