src/Query/FluentQuery.php
public function where_joined( Table $table, Closure $callback, $boolean = 'and' ) {

		$found = false;

		foreach ( $this->joined_tables as $alias => $maybe_table ) {
			if ( $maybe_table->get_slug() === $table->get_slug() ) {
				$found = $alias;
				break;
			}
		}

		if ( ! $found ) {
			throw new \InvalidArgumentException( "Table {$table->get_slug()} has not already been joined to this table." );
		}

		$other_query                = new FluentQuery( $table, $this->wpdb );
		$other_query->alias         = $found;
		$other_query->alias_count   = $this->alias_count + 1;
		$other_query->where         = Where::for_clause();
		$other_query->joined_tables = $this->joined_tables;

		$callback( $other_query );

		$boolean = 'q' . ucfirst( $boolean );
		$this->where->{$boolean}( $other_query->where );
	}
public function where_joined( Table $table, Closure $callback, $boolean = 'and' ) {

		$found = false;

		foreach ( $this->joined_tables as $alias => $maybe_table ) {
			if ( $maybe_table->get_slug() === $table->get_slug() ) {
				$found = $alias;
				break;
			}
		}

		if ( ! $found ) {
			throw new \InvalidArgumentException( "Table {$table->get_slug()} has not already been joined to this table." );
		}

		$other_query                = new FluentQuery( $table, $this->wpdb );
		$other_query->alias         = $found;
		$other_query->alias_count   = $this->alias_count + 1;
		$other_query->where         = Where::for_clause();
		$other_query->joined_tables = $this->joined_tables;

		$callback( $other_query );

		$boolean = 'q' . ucfirst( $boolean );
		$this->where->{$boolean}( $other_query->where );
	}
Add a where condition checking an already joined table to the main where clause.

@param Table   $table
@param Closure $callback
@param string  $boolean