我有以下数据:
Product Price StartDate EndDate
Apples 4.9 2010-03-01 00:00:00.000 2010-03-01 00:00:00.000
Apples 4.9 2010-03-02 00:00:00.000 2010-03-02 00:00:00.000
Apples 2.5 2010-03-03 00:00:00.000 2010-03-03 00:00:00.000
Apples 4.9 2010-03-05 00:00:00.000 2010-03-05 00:00:00.000
Apples 4.9 2010-03-06 00:00:00.000 2010-03-06 00:00:00.000
Apples 4.9 2010-03-09 00:00:00.000 2010-03-09 00:00:00.000
Apples 2.5 2010-03-10 00:00:00.000 2010-03-10 00:00:00.000
Apples 4.9 2010-03-11 00:00:00.000 2010-03-11 00:00:00.000
Apples 4.9 2010-03-12 00:00:00.000 2010-03-12 00:00:00.000
Apples 4.9 2010-03-13 00:00:00.000 2010-03-13 00:00:00.000
Apples 4.9 2010-03-15 00:00:00.000 2010-03-15 00:00:00.000
Apples 4.9 2010-03-16 00:00:00.000 2010-03-16 00:00:00.000
想要product, price, min(startdate), max(startdate)
分组,但也应该在开始日期和结束日期分组............如下所示
期望的结果
Apples 4.9 2010-03-01 00:00:00.000 2010-03-02 00:00:00.000
Apples 2.5 2010-03-03 00:00:00.000 2010-03-03 00:00:00.000
Apples 4.9 2010-03-05 00:00:00.000 2010-03-09 00:00:00.000
Apples 2.5 2010-03-10 00:00:00.000 2010-03-10 00:00:00.000
Apples 4.9 2010-03-11 00:00:00.000 2010-03-16 00:00:00.000