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

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

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

      <tfoot id='DLw0c'></tfoot>

        <legend id='DLw0c'><style id='DLw0c'><dir id='DLw0c'><q id='DLw0c'></q></dir></style></legend>
      1. 一个查询插入多行多列

        时间:2023-10-30

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

            <tfoot id='USQth'></tfoot>
            <i id='USQth'><tr id='USQth'><dt id='USQth'><q id='USQth'><span id='USQth'><b id='USQth'><form id='USQth'><ins id='USQth'></ins><ul id='USQth'></ul><sub id='USQth'></sub></form><legend id='USQth'></legend><bdo id='USQth'><pre id='USQth'><center id='USQth'></center></pre></bdo></b><th id='USQth'></th></span></q></dt></tr></i><div id='USQth'><tfoot id='USQth'></tfoot><dl id='USQth'><fieldset id='USQth'></fieldset></dl></div>
              <bdo id='USQth'></bdo><ul id='USQth'></ul>
                    <tbody id='USQth'></tbody>
                  <legend id='USQth'><style id='USQth'><dir id='USQth'><q id='USQth'></q></dir></style></legend>
                  本文介绍了一个查询插入多行多列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  假设我要插入这些数据:

                  Let's say I want to insert this data:

                  Row 1: People = '40', Places = '15'
                  Row 2: People = '5', Places = '10'
                  

                  我知道这是您执行上述操作的方式:

                  I understand that this is how you'd execute the above:

                  mysql_query("INSERT INTO mytable(`People`, `Places`) 
                  VALUES ('40', '15'),('5', '10')");
                  

                  但是如果我想用一个查询插入两个以上的列怎么办?如果要插入的数据是这样的:

                  But what if I wanted to insert into more than two columns with a single query? What if the data to be inserted was like this:

                  Row 1: People = '40', Places = '15'
                  Row 2: People = '5', Places = '10'
                  Row 3: Things = '140', Ideas = '20'
                  Row 4: People = '10', Things = '5', Ideas = '13'
                  

                  我似乎在其他任何地方都找不到这样的问题.

                  I can't seem to find a question like this anywhere else.

                  推荐答案

                  将不想填充的列保留为 null

                  Leave the columns you don't wanto to fill with null

                  INSERT INTO mytable(`People`, `Places`, Things, Ideas) 
                  VALUES ('40', '15', null, null),(null, null, 100, 20)
                  

                  这篇关于一个查询插入多行多列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:来自 $_POST 数组的多个 INSERT INTO MySQL 下一篇:将一个表中的值插入到另一个表中

                  相关文章

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

                    <bdo id='Byaaf'></bdo><ul id='Byaaf'></ul>
                  <tfoot id='Byaaf'></tfoot>

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

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