我有一个像这样的MySql表:
+-----------+------------+-----------+
|date |time_from |time_until |
+-----------+------------+-----------+
|2017-09-01 |08:00:00 |12:00:00 |
|2017-09-01 |16:00:00 |18:00:00 |
|2017-09-02 |09:00:00 |11:00:00 |
|2017-09-08 |09:30:00 |13:00:00 |
|2017-09-15 |09:00:00 |11:00:00 |
|2017-09-22 |08:45:00 |11:15:00 |
|2017-09-22 |16:15:00 |19:30:00 |
+-----------+------------+-----------+
我想按每个工作日的重叠时间范围对这些数据进行分组。每组应显示重叠时间范围的最小和最大时间。所以我需要的结果应该是这样的:
+-----------+------------+-----------+---------------------------------+
|weekday |time_from |time_until |dates |
+-----------+------------+-----------+---------------------------------+
|thurday |09:30:00 |11:00:00 |2017-09-01, 2017-09-08, 2017-...
|thurday |16:15:00 |18:00:00 |2017-09-01, 2017-09-22 |
|friday |09:30:00 |13:00:00 |2017-09-22 |
+-----------+------------+-----------+---------------------------------+
感谢您的每一条建议! : - )