<bdo id='u4J1D'></bdo><ul id='u4J1D'></ul>

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

    1. <legend id='u4J1D'><style id='u4J1D'><dir id='u4J1D'><q id='u4J1D'></q></dir></style></legend>

      <tfoot id='u4J1D'></tfoot>
    2. <small id='u4J1D'></small><noframes id='u4J1D'>

      1. 我的 sql 代码错误在哪里?

        where is the fault in my sql code?(我的 sql 代码错误在哪里?)

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

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

          <tbody id='T9fGE'></tbody>

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

                1. 本文介绍了我的 sql 代码错误在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  'SELECT * FROM t1
                            JOIN t2 ON t1.wid = t2.wid
                            WHERE t2.wid IS NULL
                            LIMIT ' . $number;
                  

                  这段代码没有任何返回给我你能帮我为什么我不取回值吗?

                  This code nothing returns to me could you help why i do not take values back??

                  推荐答案

                  JOIN t2 ON t1.wid = t1.wid
                  

                  你是那个意思吗?或者你的意思是t1.wid = t2.wid?在这种情况下,您需要左连接.

                  did you mean that? or do you really mean t1.wid = t2.wid? in which case you'd want a left join.

                  编辑

                  好的,你修好了.除非 t2 中的行的 wid 与 t1 中具有相同 wid 的行匹配,否则不会显示任何结果.

                  Okay, so you fixed it. That won't show up any results unless there are rows in t2 that have a wid that matches a row in t1 with the same wid.

                  如果你想要结果,把它改成这样:

                  If you want results, change it to this:

                  'SELECT * FROM t1
                            LEFT JOIN t2 ON t1.wid = t2.wid
                            WHERE t2.wid IS NULL
                            LIMIT ' . $number;
                  

                  下一次编辑

                  如果目标是使用 t1 中尚未在 t2 中的值来更新 t2,那么它将是这样的:

                  If the goal is to update t2 with values from t1 that aren't ALREADY in t2, then it would be something like this:

                  'INSERT INTO t2 
                     SELECT t1.* FROM t1
                       LEFT JOIN t2 
                          ON t1.wid = t2.wid
                       WHERE t2.wid IS NULL
                       LIMIT ' . $number;
                  

                  缺少的步骤只是只返回 t1 的结果,然后将它们插入到 t2 中.

                  The missing step was simply to return only t1's results, and then insert them into t2.

                  这篇关于我的 sql 代码错误在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Building a comma separated list?(建立一个逗号分隔的列表?)
                  Errors in SQL Server while importing CSV file despite varchar(MAX) being used for each column(尽管每列都使用了 varchar(MAX),但在导入 CSV 文件时 SQL Server 中出现错误)
                  How can I import an Excel file into SQL Server?(如何将 Excel 文件导入 SQL Server?)
                  Export table to file with column headers (column names) using the bcp utility and SQL Server 2008(使用 bcp 实用程序和 SQL Server 2008 将表导出到带有列标题(列名称)的文件)
                  Concat field value to string in SQL Server(将字段值连接到 SQL Server 中的字符串)
                  SQL Server Bulk insert of CSV file with inconsistent quotes(SQL Server 批量插入带有不一致引号的 CSV 文件)
                  • <i id='h53lm'><tr id='h53lm'><dt id='h53lm'><q id='h53lm'><span id='h53lm'><b id='h53lm'><form id='h53lm'><ins id='h53lm'></ins><ul id='h53lm'></ul><sub id='h53lm'></sub></form><legend id='h53lm'></legend><bdo id='h53lm'><pre id='h53lm'><center id='h53lm'></center></pre></bdo></b><th id='h53lm'></th></span></q></dt></tr></i><div id='h53lm'><tfoot id='h53lm'></tfoot><dl id='h53lm'><fieldset id='h53lm'></fieldset></dl></div>
                    <legend id='h53lm'><style id='h53lm'><dir id='h53lm'><q id='h53lm'></q></dir></style></legend>
                      <bdo id='h53lm'></bdo><ul id='h53lm'></ul>
                      1. <small id='h53lm'></small><noframes id='h53lm'>

                            <tbody id='h53lm'></tbody>
                        • <tfoot id='h53lm'></tfoot>