我下面有table 1
,其中包含打给中心的电话的数据
Date | StartTime | EndTime | Calling party | Reason | Notes
---------------------------------------------------------------------------
2017-02-2 | 09:09:17 | 09:10:50 | 1234567890 | General | Activity
2017-02-2 | 09:15:50 | 09:16:45 | 1234567890 | General | Check balance
2017-02-2 | 09:21:04 | 09:21:37 | 1234567890 | General | Close
2017-02-2 | 09:22:52 | 09:23:18 | 1234567890 | General | Transfer
2017-02-2 | 10:16:42 | 10:18:51 | 4455667788 | Helpcntr| NULL
2017-02-2 | 10:23:07 | 10:24:48 | 4455667788 | Helpcntr| Check accnt
2017-02-2 | 10:30:22 | 10:31:32 | 4455667788 | Helpcntr| Apply
... | ... | ... | ... | ... | ...
我要做的是合并具有相同电话号码的所有呼叫,同时最早的StartTime
和最新的EndTime
如下所示
Date | StartTime | EndTime | Calling party | Reason | Notes
---------------------------------------------------------------------------
2017-02-2 | 09:09:17 | 09:23:18 | 1234567890 | General | Activity
2017-02-2 | 10:16:42 | 10:31:32 | 4455667788 | Helpcntr| NULL
... | ... | ... | ... | ... | ...
请注意,Notes
和Reason
列的重要性不如其余各列,但能够将所有行中的字符串放在同一行(例如>
Date | StartTime | EndTime | Calling party | Reason | Notes
--------------------------------------------------------------------------------------------
2017-02-2 | 09:09:17 | 09:23:18 | 1234567890 | General | Activity,Check balance, Close, Transfer
2017-02-2 | 10:16:42 | 10:31:32 | 4455667788 | Helpcntr| Check accnt, Apply
... | ... | ... | ... | ... | ...
我发现的所有答案都与时间无关,因为它每天都会重复。我无法正确处理数据,因为数据很大,而且是全年的数据