Skip to content

Commit fb1176d

Browse files
committed
Fixed issue with $tableAs
Fixed issue where the right table in $onCondition needed to match $tableAs if it was set.
1 parent 575a781 commit fb1176d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/ezQuery.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,11 @@ private function joining(
267267
$tableAs = $rightTable;
268268

269269
if (\is_string($leftColumn) && empty($rightColumn))
270-
$onCondition = ' ON '.$leftTable.'.'.$leftColumn.' = '.$rightTable.'.'.$leftColumn;
270+
$onCondition = ' ON '.$leftTable.'.'.$leftColumn.' = '.$tableAs.'.'.$leftColumn;
271271
elseif ($condition !== \EQ)
272-
$onCondition = ' ON '.$leftTable.'.'.$leftColumn." $condition ".$rightTable.'.'.$rightColumn;
272+
$onCondition = ' ON '.$leftTable.'.'.$leftColumn." $condition ".$tableAs.'.'.$rightColumn;
273273
else
274-
$onCondition = ' ON '.$leftTable.'.'.$leftColumn.' = '.$rightTable.'.'.$rightColumn;
274+
$onCondition = ' ON '.$leftTable.'.'.$leftColumn.' = '.$tableAs.'.'.$rightColumn;
275275

276276
return ' '.$type.' JOIN '.$rightTable.' AS '.$tableAs.' '.$onCondition;
277277
}

0 commit comments

Comments
 (0)