我想做一个DQL查询,如:doctrine2 DQL子查询1行限制
$dql = "select p
from AcmeDemoBundle:UserTypeA p
where p.UserTypeB = :id
and (
select top 1 r.boolean
from AcmeDemoBundle:Registry r
)
= true";
但似乎TOP 1这不是在doctrine2有效的功能。
我想不出如何限制子查询的结果为一行。
类似的问题http://stackoverflow.com/questions/14234233/doctrine-2-limit-in-subquery 但没有答案,以及:( – 2013-02-13 17:54:55
这里http://stackoverflow.com/questions/24068947/ subquery-with-limit-in-doctrine可能是一个解决方案 – 2016-11-07 16:19:55