久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <legend id='Ysw13'><style id='Ysw13'><dir id='Ysw13'><q id='Ysw13'></q></dir></style></legend>
  • <tfoot id='Ysw13'></tfoot>

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

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

      1. LAST_INSERT_ID() MySQL

        LAST_INSERT_ID() MySQL(LAST_INSERT_ID() MySQL)
          <tbody id='gkGqZ'></tbody>
              <bdo id='gkGqZ'></bdo><ul id='gkGqZ'></ul>
              <tfoot id='gkGqZ'></tfoot>
              <i id='gkGqZ'><tr id='gkGqZ'><dt id='gkGqZ'><q id='gkGqZ'><span id='gkGqZ'><b id='gkGqZ'><form id='gkGqZ'><ins id='gkGqZ'></ins><ul id='gkGqZ'></ul><sub id='gkGqZ'></sub></form><legend id='gkGqZ'></legend><bdo id='gkGqZ'><pre id='gkGqZ'><center id='gkGqZ'></center></pre></bdo></b><th id='gkGqZ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='gkGqZ'><tfoot id='gkGqZ'></tfoot><dl id='gkGqZ'><fieldset id='gkGqZ'></fieldset></dl></div>

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

                  <legend id='gkGqZ'><style id='gkGqZ'><dir id='gkGqZ'><q id='gkGqZ'></q></dir></style></legend>
                  本文介紹了LAST_INSERT_ID() MySQL的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我有一個 MySQL 問題,我認為它一定很簡單.當我運行以下 MySql 查詢時,我需要從 table1 返回 LAST INSERTED ID:

                  I have a MySQL question that I think must be quite easy. I need to return the LAST INSERTED ID from table1 when I run the following MySql query:

                  INSERT INTO table1 (title,userid) VALUES ('test',1); 
                  INSERT INTO table2 (parentid,otherid,userid) VALUES (LAST_INSERT_ID(),4,1);
                  SELECT LAST_INSERT_ID();
                  

                  如您所知,當前代碼只會返回 table2 的 LAST INSERT ID 而不是 table1,即使我插入 table2 之間,我如何從 table1 獲取 ID?

                  As you can understand the current code will just return the LAST INSERT ID of table2 instead of table1, how can I get the id from table1 even if I insert into table2 between?

                  推薦答案

                  您可以將最后一個插入 id 存儲在一個變量中:

                  You could store the last insert id in a variable :

                  INSERT INTO table1 (title,userid) VALUES ('test', 1); 
                  SET @last_id_in_table1 = LAST_INSERT_ID();
                  INSERT INTO table2 (parentid,otherid,userid) VALUES (@last_id_in_table1, 4, 1);    
                  

                  或者從 table1 中獲取最大 id(警告.請參閱 Rob Starling 評論中的注釋,關于使用最大 id 時競爭條件可能導致的錯誤)

                  Or get the max id from table1 ( Warning. See note in comments from Rob Starling about possible errors from race conditions when using the max id)

                  INSERT INTO table1 (title,userid) VALUES ('test', 1); 
                  INSERT INTO table2 (parentid,otherid,userid) VALUES (LAST_INSERT_ID(), 4, 1); 
                  SELECT MAX(id) FROM table1;  
                  

                  (警告:正如 Rob Starling 在

                  (Warning: as Rob Starling points out in the

                  這篇關于LAST_INSERT_ID() MySQL的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Dropping MySQL table with SparkSQL(使用 SparkSQL 刪除 MySQL 表)
                  How to use windowing functions efficiently to decide next N number of rows based on N number of previous values(如何有效地使用窗口函數根據 N 個先前值來決定接下來的 N 個行)
                  Spark SQL/Hive Query Takes Forever With Join(Spark SQL/Hive 查詢永遠需要加入)
                  reuse the result of a select expression in the quot;GROUP BYquot; clause?(在“GROUP BY中重用選擇表達式的結果;條款?)
                  Does ignore option of Pyspark DataFrameWriter jdbc function ignore entire transaction or just offending rows?(Pyspark DataFrameWriter jdbc 函數的 ignore 選項是忽略整個事務還是只是有問題的行?) - IT屋-程序員軟件開發技
                  No suitable driver found for jdbc in Spark(在 Spark 中找不到適合 jdbc 的驅動程序)
                  <i id='syZSz'><tr id='syZSz'><dt id='syZSz'><q id='syZSz'><span id='syZSz'><b id='syZSz'><form id='syZSz'><ins id='syZSz'></ins><ul id='syZSz'></ul><sub id='syZSz'></sub></form><legend id='syZSz'></legend><bdo id='syZSz'><pre id='syZSz'><center id='syZSz'></center></pre></bdo></b><th id='syZSz'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='syZSz'><tfoot id='syZSz'></tfoot><dl id='syZSz'><fieldset id='syZSz'></fieldset></dl></div>

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

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

                          • 主站蜘蛛池模板: 日韩欧美综合 | 欧美中国少妇xxx性高请视频 | 日韩欧美在线观看 | 人人cao| 日韩影院一区 | 国产99久久精品一区二区永久免费 | 精品久久久久久中文字幕 | 美女毛片| 欧美成人免费在线 | 国产精品国产亚洲精品看不卡15 | 欧美中文一区 | 超碰人人爱 | 国产91综合一区在线观看 | 久久免费精品 | 日本天堂视频在线观看 | 国产精品久久久久久久久免费软件 | 亚洲视频一区在线观看 | 在线观看国产 | 91免费看片 | 精品久久久久久久久久 | 亚洲乱码一区二区三区在线观看 | 久久国产一区二区 | 国产精品69毛片高清亚洲 | 亚洲国产成人av | 不卡av电影在线播放 | 日韩一级黄色片 | 久久99精品久久久久子伦 | 五月激情婷婷在线 | 国产精品av久久久久久久久久 | 久久99视频精品 | 国产男女猛烈无遮掩视频免费网站 | 日韩欧美国产成人一区二区 | 天天看天天操 | 欧美一区免费 | 日韩精品一区二区三区中文字幕 | 成人午夜免费福利视频 | 日韩欧美国产一区二区 | 91精品国产乱码久久久久久久 | a级大片免费观看 | 99精品免费久久久久久久久日本 | 欧美一级全黄 |