diff --git a/Database/SqlBuilder.php b/Database/SqlBuilder.php index aefb8205..1004f939 100644 --- a/Database/SqlBuilder.php +++ b/Database/SqlBuilder.php @@ -294,10 +294,10 @@ class SqlBuilder extends Component public function tableName(): string { if ($this->query->from instanceof \Closure) { - $this->query->from = '(' . $this->query->makeClosureFunction($this->query->from) . ')'; + $this->query->from = $this->query->makeClosureFunction($this->query->from); } if ($this->query->from instanceof ActiveQuery) { - $this->query->from = '(' . SqlBuilder::builder($this->query->from)->get($this->query->from) . ')'; + $this->query->from = SqlBuilder::builder($this->query->from)->get($this->query->from); } if (empty($this->query->from)) { return $this->query->modelClass::getTable();