久久久久久久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. 僅當(dāng)值不存在時才返回行

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

                <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>
                  本文介紹了僅當(dāng)值不存在時才返回行的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(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 條件輕松選擇取消,但我正在努力解決未取消的問題,因?yàn)楹唵蔚?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
                  

                  第一個版本更直觀,但我認(rèn)為第二個版本通常會獲得更好的性能(假設(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).

                  第二個版本有效,因?yàn)?LEFT JOIN 為第一個表中的所有行返回一行.當(dāng) ON 條件成功時,這些行將包含第二個表中的列,就像 INNER JOIN 一樣.當(dāng)條件失敗時,返回的行將包含第二個表中所有列的 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)于僅當(dāng)值不存在時才返回行的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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中重用選擇表達(dá)式的結(jié)果;條款?)
                  Does ignore option of Pyspark DataFrameWriter jdbc function ignore entire transaction or just offending rows?(Pyspark DataFrameWriter jdbc 函數(shù)的 ignore 選項(xiàng)是忽略整個事務(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>
                          • 主站蜘蛛池模板: 日韩久久久久久久久久久 | 成人国产精品一级毛片视频毛片 | 久久久蜜臀国产一区二区 | 黄色成人在线观看 | 97精品超碰一区二区三区 | 亚洲国产精品区 | 久久精品亚洲国产奇米99 | 亚洲日本三级 | 亚洲精品成人网 | 国产精品毛片一区二区三区 | 97精品超碰一区二区三区 | 久热久 | 91精品国产日韩91久久久久久 | 91在线视频观看 | 久久国产亚洲 | 国精产品一品二品国精在线观看 | 日韩免费网站 | 一区二区三区欧美 | 亚洲免费高清 | 久久99精品久久久久久狂牛 | 亚洲欧美另类在线 | h视频在线播放 | 伊人国产精品 | 免费午夜剧场 | 一级毛片免费看 | 熟女毛片 | 性做久久久久久免费观看欧美 | 超碰在线人人干 | 黄色毛片网站在线观看 | 青青草原综合久久大伊人精品 | 一本色道久久综合亚洲精品高清 | 欧产日产国产精品国产 | 色婷婷激情综合 | 精品小视频| 色爱综合网 | 久久久久网站 | 久久久久国产精品一区 | 懂色中文一区二区在线播放 | 日韩一区二 | 特级黄色毛片 | 欧美日韩国产一区二区三区 |