select m.id, m.nombre, c.id, c.nombre from miembro as m inner join¿Cómo realizar esta consulta en ( select cmi.id_cargo, cmi.id_miembro, cmi.id from cargo__miembro as cmi inner joindql o ( select muc.id as idmiembro, Max(cmuc.id) as uid from miembro as muc inner join cargo__miembro as cmuc on muc.id = cmuc.id_miembro inner join cargo as c1 on cmuc.id_cargo = c1.id group by muc.id ) as cm WHERE cmi.id = cm.uid ) as cm on m.id = cm.id_miembro inner join cargo as c on cm.id_cargo = c.idquerybuilder?
select m.id, m.nombre, c.id, c.nombre from miembro as m
inner join (
select cmi.id_cargo, cmi.id_miembro, cmi.id from cargo__miembro as cmi
inner join (
select muc.id as idmiembro, Max(cmuc.id) as uid from miembro as muc
inner join cargo__miembro as cmuc on muc.id = cmuc.id_miembro
inner join cargo as c1 on cmuc.id_cargo = c1.id
group by muc.id
) as cm WHERE cmi.id = cm.uid
) as cm on m.id = cm.id_miembro
inner join cargo as c on cm.id_cargo = c.id
Estoy usando symfony 3