首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Symfony 4.4/Doctrine PostgreSQL查询不正确

Symfony 4.4/Doctrine PostgreSQL查询不正确
EN

Stack Overflow用户
提问于 2022-04-29 06:46:46
回答 1查看 74关注 0票数 -1

我的Symfony 4.4应用程序中的有一个问题。

我的查询中失败的特定部分是IS NOT TRUE部分。

我得到以下错误:

代码语言:javascript
复制
In QueryException.php line 32:
                                                                                     
  [Syntax Error] line 0, col 829: Error: Expected =, <, <=, <>, >, >=, !=, got 'IS'  
代码语言:javascript
复制
$qb = $this->_em->createQueryBuilder();
$qb->select(
   $qb->expr()->count('s.id').' AS total_clubs',
   "SUM(CASE WHEN s.currentTier = 'platinum' AND s.uefa IS NOT TRUE THEN 1 ELSE 0 END) AS platinum_clubs_non_uefa",
   "SUM(CASE WHEN s.currentTier = 'platinum' AND s.uefa = TRUE THEN 1 ELSE 0 END) AS platinum_clubs_uefa",
   "SUM(CASE WHEN s.currentTier = 'gold' THEN 1 ELSE 0 END) AS gold_clubs"
)

我尝试过各种各样的<> TRUE!= TRUE= FALSE,但是我没有能够提取出我想要的数据。

当我手动查询PostgreSQL数据库时,可以使用的查询是:

...AND uefa IS NOT TRUE;

我如何调整这个查询,从这个布尔字段中提取不真实的值?

代码语言:javascript
复制
composer show | grep doctrine                                                            
doctrine/annotations                 1.13.2             Docblock Annotations Parser
doctrine/cache                       2.1.1              PHP Doctrine Cache library is a popular cache implementation that supports many different drivers...
doctrine/collections                 1.6.8              PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.
doctrine/common                      3.3.0              PHP Doctrine Common project is a library that provides additional functionality that other Doctri...
doctrine/data-fixtures               1.5.3              Data Fixtures for all Doctrine Object Managers
doctrine/dbal                        2.13.8             Powerful PHP database abstraction layer (DBAL) with many features for database schema introspecti...
doctrine/deprecations                v0.5.3             A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable...
doctrine/doctrine-bundle             2.6.3              Symfony DoctrineBundle
doctrine/doctrine-fixtures-bundle    3.4.1              Symfony DoctrineFixturesBundle
doctrine/doctrine-migrations-bundle  3.0.3              Symfony DoctrineMigrationsBundle
doctrine/event-manager               1.1.1              The Doctrine Event Manager is a simple PHP event system that was built to be used with the variou...
doctrine/inflector                   2.0.4              PHP Doctrine Inflector is a small library that can perform string manipulations with regard to up...
doctrine/instantiator                1.4.1              A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                       1.2.3              PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
doctrine/migrations                  3.4.2              PHP Doctrine Migrations project offer additional functionality on top of the database abstraction...
doctrine/orm                         2.12.1             Object-Relational-Mapper for PHP
doctrine/persistence                 2.5.1              The Doctrine Persistence project is a set of shared interfaces and functionality that the differe...
doctrine/sql-formatter               1.1.2              a PHP SQL highlighting library
代码语言:javascript
复制
pg_config --version
PostgreSQL 12.9
psql --version
psql (PostgreSQL) 12.9
EN

回答 1

Stack Overflow用户

发布于 2022-04-29 07:04:13

而不是IS NOT TRUE,你试过= FALSE

票数 -2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72053816

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档