我想做一个 DQL 查询,如:
$dql = "select p
from AcmeDemoBundle:UserTypeA p
where p.UserTypeB = :id
and (
select top 1 r.boolean
from AcmeDemoBundle:Registry r
)
= true";
但似乎 TOP 1 它不是 Dotct2 中的有效功能。
我不知道如何将子查询的结果限制为一行。
最佳答案
DQL 不支持对子查询的限制,也不支持 LIMIT
也不是 OFFSET
.
见 http://www.doctrine-project.org/jira/browse/DDC-885
关于doctrine-orm - 学说2 DQL子查询1行限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14859803/