我想做一個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