Index: t3lib/class.t3lib_sqlparser.php =================================================================== --- t3lib/class.t3lib_sqlparser.php (revision 6058) +++ t3lib/class.t3lib_sqlparser.php (working copy) @@ -817,8 +817,12 @@ // Looking for JOIN if ($join = $this->nextPart($parseString,'^(LEFT[[:space:]]+JOIN|LEFT[[:space:]]+OUTER[[:space:]]+JOIN|JOIN)[[:space:]]+')) { $stack[$pnt]['JOIN']['type'] = $join; - if ($stack[$pnt]['JOIN']['withTable'] = $this->nextPart($parseString,'^([[:alnum:]_]+)[[:space:]]+ON[[:space:]]+',1)) { - $field1 = $this->nextPart($parseString,'^([[:alnum:]_.]+)[[:space:]]*=[[:space:]]*',1); + if ($stack[$pnt]['JOIN']['withTable'] = $this->nextPart($parseString,'^([[:alnum:]_]+)[[:space:]]+',1)) { + // Remark: 'as_keyword' and 'as' array keys are not used in compileFromTables() as the alias (if any) is + // extracted from the join condition itself. It is saved anyway for maintainability + $stack[$pnt]['JOIN']['as_keyword'] = $this->nextPart($parseString,'^(AS[[:space:]]+)'); + $stack[$pnt]['JOIN']['as'] = $this->nextPart($parseString,'^([[:alnum:]_]+)[[:space:]]*'); + $field1 = $this->nextPart($parseString,'^ON[[:space:]]+([[:alnum:]_.]+)[[:space:]]*=[[:space:]]*',1); $field2 = $this->nextPart($parseString,'^([[:alnum:]_.]+)[[:space:]]+'); if ($field1 && $field2) {