Comparing date ranges

后端 未结 10 1436
予麋鹿
予麋鹿 2020-11-22 16:10

In MySQL, If I have a list of date ranges (range-start and range-end). e.g.

10/06/1983 to 14/06/1983
15/07/1983 to 16/07/1983
18/07/1983 to 18/07/1983
         


        
10条回答
  •  鱼传尺愫
    2020-11-22 16:27

    In your expected results you say

    06/06/1983 to 18/06/1983 = IN LIST

    However, this period does not contain nor is contained by any of the periods in your table (not list!) of periods. It does, however, overlap the period 10/06/1983 to 14/06/1983.

    You may find the Snodgrass book (http://www.cs.arizona.edu/people/rts/tdbbook.pdf) useful: it pre-dates mysql but the concept of time hasn't changed ;-)

提交回复
热议问题