src/Service/DB/Select.php
protected function whereSub($column, $relation, $in)
    {
        $column = $this->adapter->quoteIdentifier($column);
        $params = [];

        if ($relation instanceof self) {
            list($sql, $params) = $relation->compile();
            $sub = $sql;
        } elseif ($relation instanceof Expr) {
            $sub = (string) $relation;
        } else {
            $sub = implode(',', $this->adapter->quote($relation));
        }

        $where = $in
               ? sprintf('%s IN (%s)', $column, $sub)
               : sprintf('%s NOT IN (%s)', $column, $sub);

        $this->where[] = [$where, $params];

        return $this;
    }
protected function whereSub($column, $relation, $in)
    {
        $column = $this->adapter->quoteIdentifier($column);
        $params = [];

        if ($relation instanceof self) {
            list($sql, $params) = $relation->compile();
            $sub = $sql;
        } elseif ($relation instanceof Expr) {
            $sub = (string) $relation;
        } else {
            $sub = implode(',', $this->adapter->quote($relation));
        }

        $where = $in
               ? sprintf('%s IN (%s)', $column, $sub)
               : sprintf('%s NOT IN (%s)', $column, $sub);

        $this->where[] = [$where, $params];

        return $this;
    }
where in 子查询语句.

@param string       $column
@param array|Select $relation
@param bool         $in

@return $this