sql查出时间段包含几个区间段

            and (
                        (begin_date  <='2020-08-01' and end_date >='2020-12-09') 
                        or (begin_date  >='2020-08-03' and end_date <='2020-12-09')
                        or (begin_date  >='2020-08-03' and end_date >='2020-12-09')
                         or (begin_date  <='2020-08-03' and end_date>='2020-08-03' and end_date <='2020-12-09')
                        )        

sql分4中情况,分别包含就行

 查询表数据如下:

 

posted @ 2020-12-09 14:18  关键步就几步  阅读(408)  评论(0编辑  收藏  举报