您好我想创建一个复杂的查询,我需要5个表中的请求信息,并通过branches.name对其进行分组。应用branches.idMunicipality的过滤器,我的查询是下一个:
$em = $this->getDoctrine()->getManager();
$companies = $em->createQuery('
SELECT categories,
subcategories,
companies,
branches,
sales
FROM AspersoftDirectorioBundle:CompanyCategory categories
JOIN categories.subcategories subcategories
JOIN subcategories.companies companies
JOIN companies.branches branches
LEFT JOIN companies.sales sales
WHERE branches.idMunicipality = :idMunicipality
GROUP BY companies.id
ORDER BY categories.name ASC'
)
->setParameter('idMunicipality' , "475")
->getResult();
return $companies;
我的问题是:
提前感谢您的帮助