这是我想使用 Doctrine2 实现的查询:
SELECT d1_.codeLieu AS codeLieu1, d1_.nomLieu AS nomLieu2, d1_.lngLieu AS lngLieu3, d1_.latLieu AS latLieu4, m2_.libelleMention AS libelleMention5, t3_.libelleType AS libelleType6, COUNT( b0_.id ) AS sclr0
FROM Delegation d1_
INNER JOIN EtablissementBac e5_ ON e5_.delegation_id = d1_.codeLieu
INNER JOIN TypeBac t3_
INNER JOIN MentionBac m2_
LEFT JOIN Bac b0_
ON b0_.etabBac_id = e5_.codeLieu -- 1st clause
AND b0_.typeBac_id = t3_.codeType -- 2nd clause
AND b0_.mentionBac_id = m2_.codeMention -- 3rd clause
WHERE m2_.codeMention IN ('TB', 'B')
AND t3_.codeType IN ('114', '129')
AND d1_.codeLieu IN('01','02','03','38','49','58')
GROUP BY d1_.codeLieu, m2_.codeMention, m2_.libelleMention, t3_.codeType, t3_.libelleType, t3_.abbrType
ORDER BY d1_.codeLieu ASC , b0_.mentionBac_id ASC , b0_.typeBac_id ASC
我在Bac
表的第 2 和第 3 个子句上遇到了一些问题。关于如何使用 Doctrine2 实现它的任何想法?由于请求是动态构建的,我不能使用本机 SQL,这就是为什么我需要使用 DQL 来构建它。