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

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

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

        <tfoot id='INqxG'></tfoot>
      1. 僅當值不存在時才返回行

        Return row only if value doesn#39;t exist(僅當值不存在時才返回行)

                <tfoot id='rDB7H'></tfoot>
              1. <i id='rDB7H'><tr id='rDB7H'><dt id='rDB7H'><q id='rDB7H'><span id='rDB7H'><b id='rDB7H'><form id='rDB7H'><ins id='rDB7H'></ins><ul id='rDB7H'></ul><sub id='rDB7H'></sub></form><legend id='rDB7H'></legend><bdo id='rDB7H'><pre id='rDB7H'><center id='rDB7H'></center></pre></bdo></b><th id='rDB7H'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='rDB7H'><tfoot id='rDB7H'></tfoot><dl id='rDB7H'><fieldset id='rDB7H'></fieldset></dl></div>
              2. <small id='rDB7H'></small><noframes id='rDB7H'>

                <legend id='rDB7H'><style id='rDB7H'><dir id='rDB7H'><q id='rDB7H'></q></dir></style></legend>
                  <bdo id='rDB7H'></bdo><ul id='rDB7H'></ul>
                    <tbody id='rDB7H'></tbody>
                  本文介紹了僅當值不存在時才返回行的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我有 2 張桌子 - reservation:

                  I have 2 tables - reservation:

                     id  | some_other_column
                     ----+------------------
                     1   | value
                     2   | value
                     3   | value
                  

                  第二個表 - reservation_log:

                     id  | reservation_id | change_type
                     ----+----------------+-------------
                     1   | 1              | create
                     2   | 2              | create
                     3   | 3              | create
                     4   | 1              | cancel
                     5   | 2              | cancel
                  

                  我只需要選擇未取消的預(yù)訂(在本例中僅為 ID 3).我可以使用簡單的 WHERE change_type = cancel 條件輕松選擇取消,但我正在努力解決未取消的問題,因為簡單的 WHERE 在這里不起作用.

                  I need to select only reservations NOT cancelled (it is only ID 3 in this example). I can easily select cancelled with a simple WHERE change_type = cancel condition, but I'm struggling with NOT cancelled, since the simple WHERE doesn't work here.

                  推薦答案

                  SELECT *
                  FROM reservation
                  WHERE id NOT IN (select reservation_id
                                   FROM reservation_log
                                   WHERE change_type = 'cancel')
                  

                  或:

                  SELECT r.*
                  FROM reservation r
                  LEFT JOIN reservation_log l ON r.id = l.reservation_id AND l.change_type = 'cancel'
                  WHERE l.id IS NULL
                  

                  第一個版本更直觀,但我認為第二個版本通常會獲得更好的性能(假設(shè)您在連接中使用的列上有索引).

                  The first version is more intuitive, but I think the second version usually gets better performance (assuming you have indexes on the columns used in the join).

                  第二個版本有效,因為 LEFT JOIN 為第一個表中的所有行返回一行.當 ON 條件成功時,這些行將包含第二個表中的列,就像 INNER JOIN 一樣.當條件失敗時,返回的行將包含第二個表中所有列的 NULL.WHERE l.id IS NULL 測試然后匹配這些行,因此它會找到表之間不匹配的所有行.

                  The second version works because LEFT JOIN returns a row for all rows in the first table. When the ON condition succeeds, those rows will include the columns from the second table, just like INNER JOIN. When the condition fails, the returned row will contain NULL for all the columns in the second table. The WHERE l.id IS NULL test then matches those rows, so it finds all the rows that don't have a match between the tables.

                  這篇關(guān)于僅當值不存在時才返回行的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  How to use windowing functions efficiently to decide next N number of rows based on N number of previous values(如何有效地使用窗口函數(shù)根據(jù) N 個先前值來決定接下來的 N 個行)
                  reuse the result of a select expression in the quot;GROUP BYquot; clause?(在“GROUP BY中重用選擇表達式的結(jié)果;條款?)
                  Does ignore option of Pyspark DataFrameWriter jdbc function ignore entire transaction or just offending rows?(Pyspark DataFrameWriter jdbc 函數(shù)的 ignore 選項是忽略整個事務(wù)還是只是有問題的行?) - IT屋-程序員軟件開發(fā)技
                  Error while using INSERT INTO table ON DUPLICATE KEY, using a for loop array(使用 INSERT INTO table ON DUPLICATE KEY 時出錯,使用 for 循環(huán)數(shù)組)
                  pyspark mysql jdbc load An error occurred while calling o23.load No suitable driver(pyspark mysql jdbc load 調(diào)用 o23.load 時發(fā)生錯誤 沒有合適的驅(qū)動程序)
                  How to integrate Apache Spark with MySQL for reading database tables as a spark dataframe?(如何將 Apache Spark 與 MySQL 集成以將數(shù)據(jù)庫表作為 Spark 數(shù)據(jù)幀讀取?)

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

                • <small id='pZjbN'></small><noframes id='pZjbN'>

                    <bdo id='pZjbN'></bdo><ul id='pZjbN'></ul>
                            <tbody id='pZjbN'></tbody>

                          <legend id='pZjbN'><style id='pZjbN'><dir id='pZjbN'><q id='pZjbN'></q></dir></style></legend>
                          • 主站蜘蛛池模板: 韩日一区| 亚洲综合视频 | 国产欧美日韩一区 | 色综合一区二区三区 | 欧美狠狠操 | 日韩一二区 | 日韩欧美一级精品久久 | 欧美一级在线免费观看 | 亚洲国产看片 | 99这里只有精品视频 | 欧美日本久久 | 91在线看网站 | 精品乱人伦一区二区三区 | 精品一区二区久久久久久久网站 | 成人免费视频 | a亚洲精品 | 欧美中文字幕一区二区三区亚洲 | 91精品国产乱码久久久久久久久 | 神马久久春色视频 | 日日干干夜夜 | 日韩在线不卡视频 | 在线资源视频 | 日本精品视频在线观看 | 久久精品国产一区二区电影 | 欧美视频免费在线观看 | 高清免费av | 全免费a级毛片免费看视频免费下 | 国产 欧美 日韩 一区 | 久久精品免费观看 | 国产精品一区在线 | 国内av在线 | 91精品国产色综合久久不卡蜜臀 | 久久丝袜 | 国产精品久久久久久久久久久久 | 日日摸日日碰夜夜爽亚洲精品蜜乳 | 国产精品久久精品 | 国产黄色电影 | 成人h动漫精品一区二区器材 | 毛片a区| 二区国产| 国产一区二区黑人欧美xxxx |