php – 如何使用Doctrine查询NOT NULL?
发布时间:2020-12-13 16:32:33 所属栏目:PHP教程 来源:网络整理
导读:我有表测试: Test:id | name 1 | aaa2 | 3 | ccc4 | aaa5 | 6 | ddd 我想要结果,其中name不为NULL: aaacccaaaddd 我如何得到: Doctrine_Core::getTable('Test')-findBy('name',NOTNULL??) -doesnt working 并在模型中与: $this-createQuery('u') -where(
我有表测试:
Test: id | name 1 | aaa 2 | 3 | ccc 4 | aaa 5 | 6 | ddd 我想要结果,其中name不为NULL: aaa ccc aaa ddd 我如何得到: Doctrine_Core::getTable('Test')->findBy('name',NOTNULL??) <-doesnt working 并在模型中与: $this->createQuery('u') ->where('name = ?',NOTNULL ???) <- doesnt working ->execute();
尝试这个:
$this->createQuery('u') ->where('name IS NOT NULL') ->execute(); 这是标准的SQL语法.原则不会将Null值转换成适当的sql. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |