在Doctrine中使用IS TRUE sql语句

时间:2017-01-28 15:30:27

标签: php mysql sql doctrine-orm doctrine

假设我有一个SQL查询:

[h(n) for n in range(1,7)]

哪种方法正常:2, 5, 41, 2306, 8143397, 94592167328105 语句将SELECT phone_id, name FROM calls c WHERE (c.user_id = 2241 AND c.phone_id IN ("Google Pixel","Samsung") AND (c.name IN ("Alex","John")) OR c.name IS NULL) IS TRUE) 表达式计算为单个表达式。

但问题是Doctrine不支持IS TRUE语句,而且此类查询会导致错误。

  

如何使用Doctrine实现相同的功能,但很明显   避免(c.name IN ("Alex","John")) OR c.name IS NULL)陈述?

1 个答案:

答案 0 :(得分:1)

评论太长了。

is true的目的是什么?

为什么不直接写这个查询呢?

SELECT phone_id, name
FROM calls c
WHERE c.user_id = 2241 AND
      c.phone_id IN ('Google Pixel', 'Samsung') AND
      (c.name IN ('Alex', 'John') OR c.name IS NULL)