doctrine-orm - 学说2 DQL子查询1行限制

标签 doctrine-orm subquery limit dql

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

相关文章:

php - Symfony2/学说 : how to add more of the same entity in the same collection?

linux - systemd中CPUQuota的使用

symfony - 为硬删除记录禁用软删除过滤器不起作用

php - 在 Symfony2 中干净地扩展 Propel 模型的策略?

php - 根据多个条件从连接中进行选择的原则

mysql - 如何将依赖子查询转换为加入以获得更好的性能?

包含在相关子查询中没有匹配项的行的 SQL 语句

mysql - 从此 SQL 查询中删除变量(子查询帮助)

c - C语言中的时间限制 - 一个测验程序

mysql - 如何获得下一个最高记录而不是最高记录?