MySQL按连续日期中的累进日期对行进行分组

时间:2018-11-22 14:01:12

标签: mysql

这是我的桌子

+------+------+------+---------------------+---------------------+
| ID_1 | ID_2 | ID_3 |        enter        |        exit         |
+------+------+------+---------------------+---------------------+
|    1 | A    | I    | 17/01/2013 15:37:25 | 18/01/2013 16:26:47 |
|    1 | A    | I    | 18/01/2013 16:26:47 | 28/01/2013 11:22:59 |
|    1 | B    | II   | 13/06/2013 22:23:54 | 21/06/2013 16:45:37 |
|    1 | B    | II   | 21/06/2013 16:45:37 | 23/06/2013 09:45:00 |
|    1 | B    | II   | 23/06/2013 09:45:00 | 23/06/2013 11:57:18 |
|    1 | B    | II   | 23/06/2013 11:57:18 | 25/06/2013 13:35:51 |
|    1 | B    | II   | 25/06/2013 14:45:21 | 25/06/2013 17:57:03 |
|    1 | B    | II   | 25/06/2013 17:57:03 | 28/06/2013 09:45:00 |
|    1 | B    | II   | 28/06/2013 09:45:00 | 28/06/2013 12:41:28 |
|    1 | B    | II   | 28/06/2013 12:41:28 | 03/07/2013 20:19:29 |
|    1 | B    | II   | 03/07/2013 20:19:29 | 05/07/2013 17:11:30 |
|    1 | B    | II   | 05/07/2013 21:33:30 | 10/07/2013 10:55:38 |
|    1 | B    | II   | 10/07/2013 13:29:58 | 09/08/2013 17:16:13 |
|    1 | B    | II   | 09/08/2013 17:16:13 | 27/09/2013 14:45:31 |
|    1 | B    | II   | 27/09/2013 14:45:31 | 11/11/2013 12:00:00 |
|    1 | C    | III  | 09/03/2014 00:14:31 | 05/04/2014 12:12:51 |
+------+------+------+---------------------+---------------------+

我的目的是在前一行的exit等于下一行的enter时按ID_1,ID_2,ID_3对行进行分组,并且我还想用{最后连续exit的结果应为

exit

是否可以在MySQL中使用它?

0 个答案:

没有答案