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

<tfoot id='iNIJp'></tfoot>

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

    1. <small id='iNIJp'></small><noframes id='iNIJp'>

      <legend id='iNIJp'><style id='iNIJp'><dir id='iNIJp'><q id='iNIJp'></q></dir></style></legend>

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

        檢查 MySQL 中日期范圍的重疊

        Check overlap of date ranges in MySQL(檢查 MySQL 中日期范圍的重疊)

              <tbody id='sC3r2'></tbody>

              <tfoot id='sC3r2'></tfoot>

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

                <legend id='sC3r2'><style id='sC3r2'><dir id='sC3r2'><q id='sC3r2'></q></dir></style></legend>

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

                  <i id='sC3r2'><tr id='sC3r2'><dt id='sC3r2'><q id='sC3r2'><span id='sC3r2'><b id='sC3r2'><form id='sC3r2'><ins id='sC3r2'></ins><ul id='sC3r2'></ul><sub id='sC3r2'></sub></form><legend id='sC3r2'></legend><bdo id='sC3r2'><pre id='sC3r2'><center id='sC3r2'></center></pre></bdo></b><th id='sC3r2'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='sC3r2'><tfoot id='sC3r2'></tfoot><dl id='sC3r2'><fieldset id='sC3r2'></fieldset></dl></div>
                • 本文介紹了檢查 MySQL 中日期范圍的重疊的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  此表用于存儲會話(事件):

                  This table is used to store sessions (events):

                  CREATE TABLE session (
                    id int(11) NOT NULL AUTO_INCREMENT
                  , start_date date
                  , end_date date
                  );
                  
                  INSERT INTO session
                    (start_date, end_date)
                  VALUES
                    ("2010-01-01", "2010-01-10")
                  , ("2010-01-20", "2010-01-30")
                  , ("2010-02-01", "2010-02-15")
                  ;
                  

                  我們不想在范圍之間發生沖突.
                  假設我們需要插入一個從 2010-01-052010-01-25 的新會話.
                  我們想知道沖突的會話.

                  We don't want to have conflict between ranges.
                  Let's say we need to insert a new session from 2010-01-05 to 2010-01-25.
                  We would like to know the conflicting session(s).

                  這是我的查詢:

                  SELECT *
                  FROM session
                  WHERE "2010-01-05" BETWEEN start_date AND end_date
                     OR "2010-01-25" BETWEEN start_date AND end_date
                     OR "2010-01-05" >= start_date AND "2010-01-25" <= end_date
                  ;
                  

                  結果如下:

                  +----+------------+------------+
                  | id | start_date | end_date   |
                  +----+------------+------------+
                  |  1 | 2010-01-01 | 2010-01-10 |
                  |  2 | 2010-01-20 | 2010-01-30 |
                  +----+------------+------------+
                  

                  有沒有更好的方法來獲得它?

                  Is there a better way to get that?

                  小提琴

                  推薦答案

                  我曾經在一個日歷應用程序中遇到過這樣的問題.我想我使用了這樣的東西:

                  I had such a query with a calendar application I once wrote. I think I used something like this:

                  ... WHERE new_start < existing_end
                        AND new_end   > existing_start;
                  

                  UPDATE 這絕對有效((ns, ne, es, ee) = (new_start, new_end, existing_start, existing_end)):

                  UPDATE This should definitely work ((ns, ne, es, ee) = (new_start, new_end, existing_start, existing_end)):

                  1. ns - ne - es - ee:不重疊且不匹配(因為 ne
                  2. ns - es - ne - ee:重疊和匹配
                  3. es - ns - ee - ne:重疊和匹配
                  4. es - ee - ns - ne:不重疊且不匹配(因為 ns > ee)
                  5. es - ns - ne - ee:重疊和匹配
                  6. ns - es - ee - ne:重疊和匹配

                  <小時>

                  這是一個小提琴

                  這篇關于檢查 MySQL 中日期范圍的重疊的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  How to use windowing functions efficiently to decide next N number of rows based on N number of previous values(如何有效地使用窗口函數根據 N 個先前值來決定接下來的 N 個行)
                  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屋-程序員軟件開發技
                  Error while using INSERT INTO table ON DUPLICATE KEY, using a for loop array(使用 INSERT INTO table ON DUPLICATE KEY 時出錯,使用 for 循環數組)
                  pyspark mysql jdbc load An error occurred while calling o23.load No suitable driver(pyspark mysql jdbc load 調用 o23.load 時發生錯誤 沒有合適的驅動程序)
                  How to integrate Apache Spark with MySQL for reading database tables as a spark dataframe?(如何將 Apache Spark 與 MySQL 集成以將數據庫表作為 Spark 數據幀讀取?)
                    1. <small id='2rDxP'></small><noframes id='2rDxP'>

                        <bdo id='2rDxP'></bdo><ul id='2rDxP'></ul>
                        <legend id='2rDxP'><style id='2rDxP'><dir id='2rDxP'><q id='2rDxP'></q></dir></style></legend>

                          <tbody id='2rDxP'></tbody>
                        <tfoot id='2rDxP'></tfoot>
                            <i id='2rDxP'><tr id='2rDxP'><dt id='2rDxP'><q id='2rDxP'><span id='2rDxP'><b id='2rDxP'><form id='2rDxP'><ins id='2rDxP'></ins><ul id='2rDxP'></ul><sub id='2rDxP'></sub></form><legend id='2rDxP'></legend><bdo id='2rDxP'><pre id='2rDxP'><center id='2rDxP'></center></pre></bdo></b><th id='2rDxP'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='2rDxP'><tfoot id='2rDxP'></tfoot><dl id='2rDxP'><fieldset id='2rDxP'></fieldset></dl></div>
                          1. 主站蜘蛛池模板: 久久综合一区 | 久草色视频 | 有码一区| 久久久久久久久毛片 | 激情视频网站 | 亚洲一区二区综合 | 中文字幕一区二区三区日韩精品 | 亚洲欧美日韩电影 | 日韩欧美一区二区三区免费观看 | 日韩精品一区二区三区视频播放 | 97日日碰人人模人人澡分享吧 | 日本亚洲精品 | 国产传媒 | 欧美亚洲视频在线观看 | 中文字幕亚洲视频 | 久久成人激情 | 男女搞网站 | www亚洲免费国内精品 | 亚洲不卡在线观看 | 久久艹免费视频 | 色又黄又爽网站www久久 | 午夜天堂精品久久久久 | 日韩高清av | 精品国产一区二区在线 | 精品中文字幕视频 | 伊人免费观看视频 | caoporn免费 | av黄在线观看 | 亚洲精品乱码8久久久久久日本 | 色婷婷激情 | 日本福利视频 | 日韩精品一区二区三区中文在线 | 日韩激情视频一区 | 99久久久久久99国产精品免 | 午夜精品一区二区三区在线观看 | 日日干夜夜操 | 欧美欧美欧美 | 免费看一区二区三区 | 最新中文字幕在线 | 中文字幕一区二区三区四区五区 | 国产日韩欧美 |