ID....| Date Created on System |.Action..............| Appointment Date
-----------------------------------------------------------------------------
ID123 |......15/03/2013 16:32..| Due....... |.NULL
ID123 |......05/04/2013 09:27..|.Appointment booked..|.08/04/2013 11:30
ID123 |......24/03/2014 11:55..|.Appointment booked..|.10/04/2014 09:30
ID123 |......09/02/2014 11:43..|.Appointment Due.....|.NULL
ID123 |......24/03/2014 11:55..|.Appointment booked..|.20/06/2014 09:30
我需要在每次“约会到期”时将上述结果分开。与随后的约会预订操作相关联,但我还需要过滤由创建日期预约的约会,以便在组中给出约会到期日期和最早的约会预约日期
即
ID....| Date Created on System |.Action............| Appointment Date
-----------------------------------------------------------------------------
ID123 |.15/03/2013 16:32.......|.Appointment Due...|...NULL
ID123 |.05/04/2013 09:27.......|.Appointment booked.|.08/04/2013 11:30
最终结果集应该是两行,如下所示
ID | Date Created on System 1 | Action 1 | Date Created on System | Action 2 | Appointment Date|
---------------------------------------------------------------------------------------------------------------------
ID123 | 15/03/2013 16:32 | Appointment Due | 05/04/2013 09:27 | Appointment booked | 08/04/2013 11:30
ID123 | 09/02/2014 11:43 | Appointment Due | 24/03/2014 11:55 | Appointment booked | 20/06/2014 09:30
提前致谢!