Skip to content

Commit 8ed37c1

Browse files
authored
Resolve BUG in _fromTables()
When there are JOINs and more than one table exists, the FROM clause must be enclosed in parentheses, otherwise an error occurs if a JOIN does not refer to the last table.
1 parent 33835f1 commit 8ed37c1

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

system/Database/BaseBuilder.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1994,6 +1994,11 @@ protected function _replace(string $table, array $keys, array $values): string
19941994
*/
19951995
protected function _fromTables(): string
19961996
{
1997+
if ( ! empty($this->QBJoin) && count($this->QBFrom) > 1)
1998+
{
1999+
return '('.implode(', ', $this->QBFrom).')';
2000+
}
2001+
19972002
return implode(', ', $this->QBFrom);
19982003
}
19992004

0 commit comments

Comments
 (0)