You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 20, 2021. It is now read-only.
I'm trying to use a Hoa\Database\Query\Select object in an INNER JOIN clause.
My goal is to get the following query:
SELECT*FROM Foo AS F
INNER JOIN (
SELECT*FROM Bar
) AS B
ONF.Foo_ID=B.Bar_ForeignKey
But I wasn't able to alias correctly my two sources.
For the Foo table I can make an alias without the keyword AS like from('Foo F').
The second alias is not well placed due to the ON clause (it's work well without).
There are my test code and the output.
$req = new \Hoa\Database\Query\Select();
$req->from('Foo')
->_as('F')
->innerJoin(
(new \Hoa\Database\Query\Select())
->from('Bar')
)
->on('F.Foo_ID = B.Bar_ForeignKey')
->_as('B');
SELECT*FROM Foo
INNER JOIN (
SELECT*FROM Bar
)
ONF.Foo_ID=B.Bar_ForeignKeyAS B
PS: Moreover the fact to don't alias an Hoa\Database\Query\Select object in an INNER JOIN clause throw a SQL error : #1248 - Every derived table must have its own alias.