使用两列表连接表

时间:2016-04-10 06:44:45

标签: php mysql symfony doctrine-orm

我有mysql查询

 SELECT `users`.`user_id`,  `tool`.`name` FROM `users` LEFT JOIN 
`project` ON
    `users`.`user_id` = `project`.`user_id` LEFT JOIN `tools` ON `users`.'user_id' = `tools`.`user_id` AND `project`.`project_id` = `tools`.`project_id`
    Where project_id = value
    and user_id = value

我的学说查询就是这个

    $query = $queryBuilder->select ( array (
                'user.userId',
                'user.name',

            ))
            ->from('Users', 'users')
    ->leftJoin(user.project, project)
    ->leftJoin(user.tool, tool)
    ->where(user.userId = value)
    ->andWhere(project.projectId = value)

现在我将如何包含 AND projectproject_id = tools。“project_id 部分到Doctrine查询构建器 没有

0 个答案:

没有答案