我有下一个查询来选择日期小于或等于$date
且(省代码为08,25,17或43或所有proposal.type
不同的集合来自simple_majority
)。下一个查询(我认为)将选择如果一种类型不同,因为有些提案属于同一个集合。
return $this->getEntityManager()
->createQuery(
"SELECT c FROM RedconviveConvocationBundle:Convocation c
INNER JOIN RedconviveConvocationBundle:Community co ON co.id = c.community_id
INNER JOIN RedconviveConvocationBundle:Proposal p ON p.convocation_id = c.id
WHERE c.date <= :date AND (co.provice_code = 08 OR co.provice_code = 25 OR co.provice_code = 17 OR co.provice_code = 43 OR p.type != simple_majority")
->setParameters(array('date' => $date))
->execute();
如果所有来自CONVOCATION的提案不等于simple_majority
,如何选择?
答案 0 :(得分:0)
你试过这个:
return $this->getEntityManager()
->createQuery(
"SELECT c FROM RedconviveConvocationBundle:Convocation c
INNER JOIN RedconviveConvocationBundle:Community co ON co.id = c.community_id
INNER JOIN RedconviveConvocationBundle:Proposal p ON p.convocation_id = c.id
WHERE c.date <= :date AND (co.provice_code = 08 OR co.provice_code = 25 OR co.provice_code = 17 OR co.provice_code = 43) AND p.type != simple_majority")
->setParameters(array('date' => $date))
->execute();