MYSQL:更新日期范围与特定日期范围内的最低记录不重叠

时间:2015-07-29 01:14:05

标签: mysql date range

我一直试图找出这个查询的时间最长,但却无法得到它。这是我想要做的:

我想拍这个数据

+------------+------------+-------+ | StartDate | EndDate | Value | +------------+------------+-------+ | 2015-01-01 | 2015-01-31 | 10 | | 2015-01-12 | 2015-01-15 | 9 | | 2015-01-18 | 2015-01-19 | 8 | +------------+------------+-------+

把它变成这个:

+------------+------------+-------+ | StartDate | EndDate | Value | +------------+------------+-------+ | 2015-01-01 | 2015-01-14 | 10 | | 2015-01-12 | 2015-01-15 | 9 | | 2015-01-16 | 2015-01-17 | 10 | | 2015-01-18 | 2015-01-19 | 8 | | 2015-01-20 | 2015-01-31 | 10 | +------------+------------+-------+

关于我如何解决这个问题的任何想法?

提前谢谢!

0 个答案:

没有答案