【发布时间】:2015-05-27 17:41:19
【问题描述】:
我想将此sql查询转换为实体管理器的学说:
SELECT count(c.id)
FROM content c
WHERE c.id IN
(SELECT tdtc.content_id
FROM tdtheme_content tdtc
JOIN tdtheme tdt ON tdtc.tdtheme_id = tdt.id
JOIN td t ON tdt.td_id = t.id
JOIN matiere m ON t.matiere_id = m.id
WHERE m.id = 2)
OR c.id IN
(SELECT sc.content_id
FROM semaine_content sc
JOIN semaine s ON sc.semaine_id = s.id
JOIN cour cr ON s.cour_id = cr.id
JOIN matiere m ON cr.matiere_id = m.id
WHERE m.id = 2)
OR c.id IN
(SELECT ac.content_id
FROM annale_content ac
JOIN annale a ON ac.annale_id = a.id
JOIN matiere m ON a.matiere_id = m.id
WHERE m.id = 2)');
我有:
Annale 和 Td 和 Cours 的 Matiere
有内容的年鉴
Td With Tdtheme With Contents
Courses With Semaines with Contents
我想计算一个 matiere 的内容数
有什么想法吗?
感谢和抱歉我的英语不好^^
【问题讨论】:
-
欢迎来到 Stack Overflow!这个问题的信息有点少。能分享一下你尝试过的,遇到了什么问题吗?
标签: php symfony doctrine-orm doctrine