definition = array( 'table' => 'project_release_nodes', 'field' => 'pid', 'left_table' => 'node', 'left_field' => 'nid', ); if (!empty($this->options['required'])) { $join->definition['type'] = 'INNER'; } $join->construct(); $this->first_join = $this->query->add_table('project_release_nodes', $this->relationship, $join); // Then, create a relationship on that table: $join = new views_join(); $join->definition = array( 'left_table' => $this->first_join, 'left_field' => 'nid', 'table' => 'node', 'field' => 'nid', ); if (!empty($this->options['required'])) { $join->definition['type'] = 'INNER'; } $join->construct(); $alias = $join->definition['table'] . '_' . $join->definition['left_table']; $this->alias = $this->query->add_relationship($alias, $join, 'node', $this->relationship); } }