Doctrine DQL如何编写SELECT EXISTS

时间:2017-02-16 17:02:33

标签: doctrine dql

这是基于有效的SQL,但我不能让它在DQL中工作

SELECT 
    EXISTS (
        SELECT activity FROM Entity\Activity activity
        WHERE activity MEMBER OF person.activities
        AND activity.name = 'sports'
   ) AS doesSports,
   person.id 
FROM Entity\Person person 

这给出了错误:

[Syntax Error] line 0, col 7: Error: Expected known function, got 'EXISTS'

EXISTS似乎在WHERE之后工作,但在select

中没有

1 个答案:

答案 0 :(得分:0)

语法不允许所谓的"其他表达式"在SELECT子句中,只允许使用函数。