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

  • <legend id='tsTue'><style id='tsTue'><dir id='tsTue'><q id='tsTue'></q></dir></style></legend>

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

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

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

        組合/合并日期范圍的算法

        Algorithm to combine / merge date ranges(組合/合并日期范圍的算法)
          • <tfoot id='UEabL'></tfoot>
            <legend id='UEabL'><style id='UEabL'><dir id='UEabL'><q id='UEabL'></q></dir></style></legend>

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

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

                  本文介紹了組合/合并日期范圍的算法的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我試圖找到將日期范圍合并到一個數(shù)據(jù)庫記錄(數(shù)組元素)的最佳方法.

                  I am trying to find the best way on how to merge date ranges into one database record (array element).

                  這是我擁有的數(shù)據(jù):

                    Array
                  (
                      [0] => Array
                          (
                              [id] => 18298
                              [start_date] => 2011-07-09
                              [end_date] => 2011-10-01
                          )
                  
                      [1] => Array
                          (
                              [id] => 18297
                              [start_date] => 2011-06-01
                              [end_date] => 2011-06-30
                          )
                  
                      [2] => Array
                          (
                              [id] => 17113
                              [start_date] => 2011-03-31
                              [end_date] => 2011-05-31
                          )
                  
                      [3] => Array
                          (
                              [id] => 20555
                              [start_date] => 2011-01-03
                              [end_date] => 2011-03-31
                          )
                  )
                  

                  在我們組合它們之后,數(shù)組(或數(shù)據(jù)庫)應(yīng)該是這樣的:

                  And after we combine them, array (or database) should look like this:

                  Array
                  (
                      [0] => Array
                          (
                              [merged_ids] => 18298
                              [start_date] => 2011-07-09
                              [end_date] => 2011-10-01
                          )
                  
                      [1] => Array
                          (
                              [merged_ids] => 18297, 17113, 20555
                              [start_date] => 2011-01-03
                              [end_date] => 2011-06-30
                          )
                  )
                  

                  是否有任何算法可以遍歷所有元素/范圍并將它們組合起來?哪種方式更好/更容易 - 通過數(shù)據(jù)庫 (MYSQL) 或編碼 (PHP)?

                  Is there any algorithm to go through all elements/ranges and combine them? Which way is better/easier to do - through database (MYSQL) or coding (PHP)?

                  非常感謝任何建議.

                  謝謝!

                  更新:抱歉,我沒有提供足夠的信息:我們應(yīng)該合并任何連續(xù)和重疊的日期范圍.

                  UPDATE: Sorry, I didn't provide enough info: we should merge any continuous and overlapping date ranges.

                  推薦答案

                  按開始日期排序.

                  然后迭代并檢查下一個項目的開始日期是在當(dāng)前項目的結(jié)束日期之前還是之后.如果是,則將下一個合并到當(dāng)前一個.然后繼續(xù).

                  Then iterate through and check for if the next item's start date is before or directly after the current one's end date. If it is, then merge the next one into the current one. Then continue.

                  這篇關(guān)于組合/合并日期范圍的算法的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標(biāo)不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術(shù)方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅(qū)動程序)

                      <tbody id='bC0jD'></tbody>

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

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

                            <legend id='bC0jD'><style id='bC0jD'><dir id='bC0jD'><q id='bC0jD'></q></dir></style></legend><tfoot id='bC0jD'></tfoot>

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

                          2. 主站蜘蛛池模板: 久久久妇女国产精品影视 | 久久精品亚洲精品国产欧美 | 日韩男人天堂 | 精品国产一区二区三区久久久蜜月 | 日韩av一区二区在线观看 | 国内自拍视频在线观看 | 81精品国产乱码久久久久久 | 色网在线观看 | 精品国产不卡一区二区三区 | 久久久久久久久久久久久9999 | 亚洲欧美激情精品一区二区 | 久久丝袜| 国产精品一区二区福利视频 | 亚洲毛片在线观看 | 天天操网 | 欧美日韩电影一区 | 久久最新| www.操.com | 男人影音 | 亚洲第一黄色网 | 日韩人体视频 | 欧美一级片在线看 | 国产亚洲精品91 | 天天躁日日躁狠狠躁白人 | 成人高清视频在线观看 | 一级片aaa | 久久首页 | 日本不卡一区二区三区在线观看 | 你懂的在线视频播放 | 久久久久久久久久久久久9999 | 久久精品99| 欧美精品福利视频 | 亚洲精品综合一区二区 | 日本在线中文 | 国产伦精品 | 欧美韩一区二区三区 | 免费黄色a视频 | 久久精品欧美一区二区三区麻豆 | 91夜夜夜| 一级黄色毛片免费 | 黄免费在线 |