我有一个查询来选择所有未投票的提案ProProposalBundle:Proposal\Vote
。 "not_voted"
中可能存在v.decision
值,或者可能不存在NOT EXIST
值。这就是我使用SELECT p
FROM ProProposalBundle:Proposal p
INNER JOIN ProProposalBundle:Proposal\Vote v
WITH v.proposal = p
AND (v.decision = 'not_voted' OR NOT EXISTS (SELECT v FROM v WHERE v.user = {$user}))
WHERE p.community = {$community}
的原因。
[Semantical Error] line 0, col 181 near 'v WHERE v.user': Error: Class 'v' is not defined.
但它给我一个错误:
NOT EXISTS
并且它与v
部分有关,其中... NOT EXISTS (SELECT v FROM ProProposalBundle:Proposal\Vote v WHERE v.user = {$user}))
在理论上定义之前。我也尝试过:
[Semantical Error] line 0, col 220 near 'v WHERE v.user': Error: 'v' is already defined.
但现在我得到了:
{{1}}
知道我做错了什么?
答案 0 :(得分:0)
试
NOT EXISTS (SELECT * FROM ProProposalBundle:Proposal\Vote v WHERE v.user = {$user}))