<tfoot id='uAJaJ'></tfoot>

      <small id='uAJaJ'></small><noframes id='uAJaJ'>

      <legend id='uAJaJ'><style id='uAJaJ'><dir id='uAJaJ'><q id='uAJaJ'></q></dir></style></legend>
        • <bdo id='uAJaJ'></bdo><ul id='uAJaJ'></ul>

        <i id='uAJaJ'><tr id='uAJaJ'><dt id='uAJaJ'><q id='uAJaJ'><span id='uAJaJ'><b id='uAJaJ'><form id='uAJaJ'><ins id='uAJaJ'></ins><ul id='uAJaJ'></ul><sub id='uAJaJ'></sub></form><legend id='uAJaJ'></legend><bdo id='uAJaJ'><pre id='uAJaJ'><center id='uAJaJ'></center></pre></bdo></b><th id='uAJaJ'></th></span></q></dt></tr></i><div id='uAJaJ'><tfoot id='uAJaJ'></tfoot><dl id='uAJaJ'><fieldset id='uAJaJ'></fieldset></dl></div>

        如何在 Doctrine 查询生成器中进行多个 WHERE IN 列查询?

        How to make multiple WHERE IN column query in Doctrine query builder?(如何在 Doctrine 查询生成器中进行多个 WHERE IN 列查询?)

        <small id='cnQ5B'></small><noframes id='cnQ5B'>

          <legend id='cnQ5B'><style id='cnQ5B'><dir id='cnQ5B'><q id='cnQ5B'></q></dir></style></legend>
              • <bdo id='cnQ5B'></bdo><ul id='cnQ5B'></ul>
                <i id='cnQ5B'><tr id='cnQ5B'><dt id='cnQ5B'><q id='cnQ5B'><span id='cnQ5B'><b id='cnQ5B'><form id='cnQ5B'><ins id='cnQ5B'></ins><ul id='cnQ5B'></ul><sub id='cnQ5B'></sub></form><legend id='cnQ5B'></legend><bdo id='cnQ5B'><pre id='cnQ5B'><center id='cnQ5B'></center></pre></bdo></b><th id='cnQ5B'></th></span></q></dt></tr></i><div id='cnQ5B'><tfoot id='cnQ5B'></tfoot><dl id='cnQ5B'><fieldset id='cnQ5B'></fieldset></dl></div>

                  <tfoot id='cnQ5B'></tfoot>
                    <tbody id='cnQ5B'></tbody>
                  本文介绍了如何在 Doctrine 查询生成器中进行多个 WHERE IN 列查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想使用带有两列检查的 WHERE IN 语句更新 db 中的多条记录.

                  I would like to update multiple records in db using WHERE IN statement with two column check.

                  Pure MySql 原始查询看起来像这样.. 它可以工作:

                  Pure MySql raw query looks something like this.. and it works:

                  UPDATE poll_quota q SET q.count = q.count+1 WHERE q.form_id=14 AND ((q.field_id,q.value) IN (('A',1),('B',1)))
                  

                  我的代码:

                  $this->createQueryBuilder("q")
                              ->update()
                              ->set("q.count","q.count+1")
                              ->where("q.form_id=:form_id")
                              ->andWhere("((q.field_id,q.value) IN (:wherein))")
                              ->setParameter(":form_id",$form_id)
                              ->setParameter(":wherein",$where_in)
                              ->getQuery()
                              ->execute()
                          ;
                  

                  输出:

                  [Syntax Error] line 0, col 103: Error: Expected DoctrineORMQueryLexer::T_CLOSE_PARENTHESIS, got ','
                  
                  [1/2] QueryException: UPDATE EdgePollBundleEntityQuota q SET q.count = q.count+1 WHERE q.form_id=:form_id AND ((q.field_id,q.value) IN (:wherein))   +
                  

                  尝试这样做,也不起作用:

                  Attemp to do sth like this, also doesn't work:

                  [...]->andWhere("((q.field_id,q.value) IN ({$where_in}))")
                  

                  $where_in 包含这样的字符串:

                  $where_in contains string like this:

                  "('A',1),('B',1)"
                  

                  推荐答案

                  DQL 不允许在 WHERE IN 语句中使用多个列,因为并非所有 DBMS 都支持它.您可以使用 $this->getEntityManager()->getConnection()->executeUpdate()

                  DQL doesn't allow using multiple columns in a WHERE IN statement since not all DBMS support it. You can run it with the raw SQL using $this->getEntityManager()->getConnection()->executeUpdate()

                  这篇关于如何在 Doctrine 查询生成器中进行多个 WHERE IN 列查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                    <tbody id='33ibJ'></tbody>
                  <legend id='33ibJ'><style id='33ibJ'><dir id='33ibJ'><q id='33ibJ'></q></dir></style></legend>

                    1. <tfoot id='33ibJ'></tfoot>

                        • <bdo id='33ibJ'></bdo><ul id='33ibJ'></ul>

                          <small id='33ibJ'></small><noframes id='33ibJ'>

                            <i id='33ibJ'><tr id='33ibJ'><dt id='33ibJ'><q id='33ibJ'><span id='33ibJ'><b id='33ibJ'><form id='33ibJ'><ins id='33ibJ'></ins><ul id='33ibJ'></ul><sub id='33ibJ'></sub></form><legend id='33ibJ'></legend><bdo id='33ibJ'><pre id='33ibJ'><center id='33ibJ'></center></pre></bdo></b><th id='33ibJ'></th></span></q></dt></tr></i><div id='33ibJ'><tfoot id='33ibJ'></tfoot><dl id='33ibJ'><fieldset id='33ibJ'></fieldset></dl></div>