definition['base']); $base_field = empty($this->definition['base field']) ? $table_data['table']['base']['field'] : $this->definition['base field']; $this->ensure_my_table(); // We need to figure out the alias of our base table based upon our relationship: if ($this->relationship) { $base_table = $this->relationship; } else { $base_table = $this->query->base_table; } $def = $this->definition; $def['table'] = $this->definition['base']; $def['field'] = $base_field; $def['left_table'] = ''; $def['left_field'] = "COALESCE($this->table.$this->real_field, $base_table.$this->real_field)"; $def['type'] = 'INNER'; $join = new views_join(); $join->definition = $def; $join->construct(); $join->adjusted = TRUE; // use a short alias for this: $alias = $def['table'] . '_' . $this->table; $this->alias = $this->query->add_relationship($alias, $join, $this->definition['base'], $this->relationship); } }