I want to use a query builder for this complex generic query.
(new Query)->select([
"aliasRefId" => "posts.id"
"itemA" => (new Query)->select(["itA"])
->from(["table_name"])
->where(["table_name.itemId" => "aliasRefId"])
])->from(["posts]);
The generated query should be:
SELECT
posts.id as aliasRefId,
( SELECT itA
FROM table_name
WHERE table_name.itemId = aliasRefId ) as itemA
FROM posts
The problem is that I can’t use aliasRefId in that inner select.