2

我需要帮助在 MySQL 5.0.77 中制作一个查询,根据下面显示的数据(办公室一天的通话量)返回并发电话呼叫的峰值数量。我只是想知道在一天中的任何特定时间同时打电话的人数最多是多少。

首先,这是 MySQL 表:

CREATE TABLE `call_log` (
`call_id` int(11) NOT NULL auto_increment,
`call_datetime` datetime default NULL,
`call_length` time default NULL,
PRIMARY KEY  (`call_id`)
)

我使用以下命令将数据加载到表中:

LOAD DATA LOCAL INFILE 'call_log_import.csv' INTO TABLE call_log FIELDS TERMINATED BY ',' LINE TERMINATED BY '\n' (call_datetime, call_length);

这是 CSV 格式的实际行数据:

2012-11-07 5:28:00,0:00:20
2012-11-07 7:04:00,0:00:20
2012-11-07 7:04:00,0:00:30
2012-11-07 7:04:00,0:00:30
2012-11-07 7:25:00,0:00:34
2012-11-07 7:25:00,0:00:37
2012-11-07 7:25:00,0:00:38
2012-11-07 7:30:00,0:00:16
2012-11-07 7:49:00,0:01:29
2012-11-07 7:55:00,0:00:43
2012-11-07 7:55:00,0:00:46
2012-11-07 7:55:00,0:00:46
2012-11-07 8:00:00,0:25:01
2012-11-07 8:00:00,0:00:35
2012-11-07 8:01:00,0:00:35
2012-11-07 8:01:00,0:00:35
2012-11-07 8:02:00,0:00:36
2012-11-07 8:02:00,0:03:03
2012-11-07 8:07:00,0:00:07
2012-11-07 8:08:00,0:00:08
2012-11-07 8:12:00,0:00:34
2012-11-07 8:12:00,0:00:44
2012-11-07 8:18:00,0:01:05
2012-11-07 8:28:00,0:01:05
2012-11-07 8:29:00,0:00:18
2012-11-07 8:31:00,0:00:05
2012-11-07 8:31:00,0:00:00
2012-11-07 8:31:00,0:00:11
2012-11-07 8:32:00,0:00:01
2012-11-07 8:32:00,0:27:26
2012-11-07 8:32:00,0:00:00
2012-11-07 8:32:00,0:00:00
2012-11-07 8:32:00,0:00:00
2012-11-07 8:32:00,0:00:38
2012-11-07 8:33:00,0:00:35
2012-11-07 8:33:00,0:00:04
2012-11-07 8:34:00,0:01:10
2012-11-07 8:35:00,0:09:44
2012-11-07 8:35:00,0:22:21
2012-11-07 8:35:00,0:00:17
2012-11-07 8:35:00,0:21:42
2012-11-07 8:35:00,0:21:46
2012-11-07 8:35:00,0:21:46
2012-11-07 8:37:00,0:00:29
2012-11-07 8:38:00,0:00:29
2012-11-07 8:39:00,0:06:50
2012-11-07 8:39:00,0:08:23
2012-11-07 8:53:00,0:05:01
2012-11-07 8:53:00,0:05:05
2012-11-07 8:53:00,0:05:05
2012-11-07 8:57:00,0:01:04
2012-11-07 9:00:00,0:29:40
2012-11-07 9:01:00,0:00:20
2012-11-07 9:01:00,0:01:27
2012-11-07 9:02:00,0:27:00
2012-11-07 9:03:00,0:26:18
2012-11-07 9:03:00,0:00:18
2012-11-07 9:09:00,0:01:16
2012-11-07 9:12:00,0:02:53
2012-11-07 9:12:00,0:01:09
2012-11-07 9:12:00,0:27:27
2012-11-07 9:14:00,0:07:13
2012-11-07 9:14:00,0:07:18
2012-11-07 9:14:00,0:07:18
2012-11-07 9:18:00,0:11:39
2012-11-07 9:18:00,0:11:55
2012-11-07 9:18:00,0:00:16
2012-11-07 9:17:00,0:12:15
2012-11-07 9:18:00,0:00:48
2012-11-07 9:18:00,0:00:52
2012-11-07 9:18:00,0:00:52
2012-11-07 9:19:00,0:01:12
2012-11-07 9:21:00,0:00:03
2012-11-07 9:22:00,0:02:41
2012-11-07 9:22:00,0:02:36
2012-11-07 9:22:00,0:02:49
2012-11-07 9:24:00,0:01:34
2012-11-07 9:25:00,0:06:10
2012-11-07 9:25:00,0:06:14
2012-11-07 9:25:00,0:06:14
2012-11-07 9:31:00,0:00:43
2012-11-07 9:33:00,0:00:03
2012-11-07 9:33:00,0:00:03
2012-11-07 9:33:00,0:00:03
2012-11-07 9:33:00,0:00:03
2012-11-07 9:33:00,0:00:03
2012-11-07 9:33:00,0:05:57
2012-11-07 9:32:00,0:00:30
2012-11-07 9:32:00,0:00:30
2012-11-07 9:32:00,0:06:28
2012-11-07 9:32:00,0:06:53
2012-11-07 9:32:00,0:00:35
2012-11-07 9:32:00,0:00:20
2012-11-07 9:32:00,0:01:04
2012-11-07 9:32:00,0:01:04
2012-11-07 9:32:00,0:00:41
2012-11-07 9:36:00,0:00:27
2012-11-07 9:37:00,0:23:53
2012-11-07 9:38:00,0:01:51
2012-11-07 9:40:00,0:06:40
2012-11-07 9:40:00,0:06:44
2012-11-07 9:40:00,0:06:44
2012-11-07 9:44:00,0:01:19
2012-11-07 9:46:00,0:00:55
2012-11-07 9:46:00,0:02:01
2012-11-07 9:47:00,0:20:00
2012-11-07 9:47:00,0:02:22
2012-11-07 9:47:00,0:07:12
2012-11-07 9:47:00,0:02:22
2012-11-07 9:47:00,0:00:13
2012-11-07 9:48:00,0:00:41
2012-11-07 9:48:00,0:01:25
2012-11-07 9:50:00,0:01:24
2012-11-07 9:52:00,0:00:06
2012-11-07 9:54:00,0:00:06
2012-11-07 9:57:00,0:00:28
2012-11-07 9:57:00,0:00:20
2012-11-07 9:57:00,0:00:48
2012-11-07 9:58:00,0:00:06
2012-11-07 9:58:00,0:00:06
2012-11-07 9:58:00,0:00:06
2012-11-07 9:58:00,0:00:06
2012-11-07 9:58:00,0:00:06
2012-11-07 9:58:00,0:06:49
2012-11-07 9:58:00,0:07:19
2012-11-07 9:58:00,0:00:30
2012-11-07 9:58:00,0:00:30
2012-11-07 9:58:00,0:07:38
2012-11-07 9:58:00,0:01:36
2012-11-07 9:59:00,0:00:59
2012-11-07 9:59:00,0:01:00
2012-11-07 10:00:00,0:17:43
2012-11-07 10:00:00,0:00:21
2012-11-07 10:00:00,1:02:29
2012-11-07 10:01:00,0:00:03
2012-11-07 10:01:00,0:00:03
2012-11-07 10:01:00,0:00:52
2012-11-07 10:01:00,0:20:23
2012-11-07 10:01:00,0:01:09
2012-11-07 10:01:00,0:00:20
2012-11-07 10:01:00,0:01:15
2012-11-07 10:02:00,0:00:01
2012-11-07 10:02:00,0:00:36
2012-11-07 10:02:00,0:00:48
2012-11-07 10:02:00,0:21:49
2012-11-07 10:03:00,0:40:24
2012-11-07 10:04:00,0:00:02
2012-11-07 10:04:00,0:00:02
2012-11-07 10:04:00,0:00:02
2012-11-07 10:04:00,0:05:59
2012-11-07 10:04:00,0:00:02
2012-11-07 10:04:00,0:00:02
2012-11-07 10:04:00,0:05:59
2012-11-07 10:03:00,0:06:20
2012-11-07 10:03:00,0:00:22
2012-11-07 10:06:00,0:20:35
2012-11-07 10:07:00,0:02:44
2012-11-07 10:08:00,0:00:01
2012-11-07 10:09:00,0:00:29
2012-11-07 10:09:00,0:01:17
2012-11-07 10:10:00,0:00:02
2012-11-07 10:11:00,0:00:02
2012-11-07 10:12:00,0:01:43
2012-11-07 10:12:00,0:24:01
2012-11-07 10:12:00,0:24:04
2012-11-07 10:12:00,0:24:04
2012-11-07 10:12:00,0:01:23
2012-11-07 10:13:00,0:03:51
2012-11-07 10:13:00,0:03:40
2012-11-07 10:14:00,0:09:52
2012-11-07 10:16:00,0:13:33
2012-11-07 10:16:00,0:13:37
2012-11-07 10:16:00,0:13:37
2012-11-07 10:21:00,0:00:20
2012-11-07 10:21:00,0:01:18
2012-11-07 10:21:00,0:01:18
2012-11-07 10:22:00,0:00:21
2012-11-07 10:22:00,0:00:32
2012-11-07 10:22:00,0:00:32
2012-11-07 10:22:00,0:04:31
2012-11-07 10:22:00,0:00:57
2012-11-07 10:23:00,0:10:23
2012-11-07 10:24:00,0:01:20
2012-11-07 10:24:00,0:01:24
2012-11-07 10:24:00,0:01:24
2012-11-07 10:25:00,0:27:34
2012-11-07 10:28:00,0:00:49
2012-11-07 10:30:00,0:01:46
2012-11-07 10:30:00,0:01:51
2012-11-07 10:30:00,0:01:51
2012-11-07 10:30:00,0:01:01
2012-11-07 10:31:00,0:00:43
2012-11-07 10:31:00,0:15:08
2012-11-07 10:33:00,0:02:37
2012-11-07 10:35:00,0:00:21
2012-11-07 10:35:00,0:01:24
2012-11-07 10:35:00,0:01:24
2012-11-07 10:37:00,0:02:07
2012-11-07 10:37:00,0:00:08
2012-11-07 10:38:00,0:00:10
2012-11-07 10:39:00,0:01:37
2012-11-07 10:39:00,0:00:21
2012-11-07 10:39:00,0:01:53
2012-11-07 10:39:00,0:00:03
2012-11-07 10:40:00,0:00:34
2012-11-07 10:41:00,0:00:00
2012-11-07 10:41:00,0:00:00
2012-11-07 10:41:00,0:00:00
2012-11-07 10:41:00,0:02:20
2012-11-07 10:45:00,0:07:57
2012-11-07 10:51:00,0:00:20
2012-11-07 10:51:00,0:00:56
2012-11-07 10:50:00,0:01:12
2012-11-07 10:50:00,0:00:04
2012-11-07 10:50:00,0:00:04
2012-11-07 10:50:00,0:00:04
2012-11-07 10:50:00,0:00:04
2012-11-07 10:50:00,0:00:04
2012-11-07 10:50:00,0:01:44
2012-11-07 10:50:00,0:00:31
2012-11-07 10:50:00,0:00:31
2012-11-07 10:49:00,0:03:05
2012-11-07 10:54:00,0:00:20
2012-11-07 10:54:00,0:01:02
2012-11-07 10:54:00,0:01:02
2012-11-07 10:55:00,0:02:08
2012-11-07 10:56:00,0:00:33
2012-11-07 10:56:00,0:00:05
2012-11-07 10:59:00,0:24:33
2012-11-07 10:59:00,0:24:37
2012-11-07 10:59:00,0:24:37
2012-11-07 11:00:00,0:29:41
2012-11-07 11:00:00,0:07:38
2012-11-07 11:00:00,0:00:51
2012-11-07 11:01:00,0:00:33
2012-11-07 11:02:00,0:28:12
2012-11-07 11:02:00,0:35:02
2012-11-07 11:02:00,0:35:05
2012-11-07 11:02:00,0:35:05
2012-11-07 11:02:00,0:21:29
2012-11-07 11:03:00,0:02:24
2012-11-07 11:03:00,0:02:28
2012-11-07 11:03:00,0:02:28
2012-11-07 11:03:00,0:00:03
2012-11-07 11:04:00,0:34:28
2012-11-07 11:04:00,0:08:20
2012-11-07 11:04:00,0:01:01
2012-11-07 11:06:00,0:16:09
2012-11-07 11:08:00,0:00:50
2012-11-07 11:11:00,0:02:08
2012-11-07 11:14:00,0:01:22
2012-11-07 11:14:00,0:01:26
2012-11-07 11:14:00,0:01:26
2012-11-07 11:14:00,0:00:20
2012-11-07 11:14:00,0:00:57
2012-11-07 11:14:00,0:00:57
2012-11-07 11:15:00,0:09:48
2012-11-07 11:15:00,0:11:10
2012-11-07 11:16:00,0:00:55
2012-11-07 11:18:00,0:00:48
2012-11-07 11:22:00,0:00:51
2012-11-07 11:22:00,0:00:51
2012-11-07 11:22:00,0:00:51
2012-11-07 11:22:00,0:01:16
2012-11-07 11:28:00,0:03:36
2012-11-07 11:29:00,0:13:18
2012-11-07 11:30:00,0:03:47
2012-11-07 11:30:00,0:20:44
2012-11-07 11:30:00,0:01:29
2012-11-07 11:32:00,0:00:39
2012-11-07 11:32:00,0:07:04
2012-11-07 11:35:00,0:02:04
2012-11-07 11:35:00,0:00:20
2012-11-07 11:35:00,0:00:32
2012-11-07 11:35:00,0:00:32
2012-11-07 11:37:00,0:18:14
2012-11-07 11:37:00,0:18:14
2012-11-07 11:37:00,0:00:17
2012-11-07 11:37:00,0:00:18
2012-11-07 11:37:00,0:00:18
2012-11-07 11:36:00,0:18:57
2012-11-07 11:37:00,0:24:10
2012-11-07 11:38:00,0:00:19
2012-11-07 11:38:00,0:00:02
2012-11-07 11:38:00,0:00:02
2012-11-07 11:38:00,0:01:29
2012-11-07 11:41:00,0:00:02
2012-11-07 11:41:00,0:00:02
2012-11-07 11:41:00,0:00:02
2012-11-07 11:41:00,0:04:48
2012-11-07 11:41:00,0:00:02
2012-11-07 11:41:00,0:00:02
2012-11-07 11:41:00,0:04:48
2012-11-07 11:40:00,0:05:09
2012-11-07 11:41:00,0:01:41
2012-11-07 11:42:00,0:15:24
2012-11-07 11:42:00,0:15:30
2012-11-07 11:42:00,0:15:30
2012-11-07 11:59:00,0:00:20
2012-11-07 11:59:00,0:00:31
2012-11-07 11:59:00,0:00:31
2012-11-07 12:00:00,0:08:56
2012-11-07 12:01:00,0:22:31
2012-11-07 12:02:00,0:00:26
2012-11-07 12:02:00,0:33:20
2012-11-07 12:03:00,0:33:45
2012-11-07 12:06:00,0:00:56
2012-11-07 12:18:00,0:00:55
2012-11-07 12:18:00,0:00:55
2012-11-07 12:18:00,0:01:04
2012-11-07 12:24:00,0:00:02
2012-11-07 12:24:00,0:00:02
2012-11-07 12:24:00,0:00:25
2012-11-07 12:25:00,0:00:21
2012-11-07 12:25:00,0:01:08
2012-11-07 12:25:00,0:01:08
2012-11-07 12:26:00,0:00:20
2012-11-07 12:26:00,0:00:54
2012-11-07 12:26:00,0:00:54
2012-11-07 12:29:00,0:00:11
2012-11-07 12:31:00,0:02:10
2012-11-07 12:31:00,0:12:35
2012-11-07 12:31:00,0:06:26
2012-11-07 12:46:00,0:00:34
2012-11-07 12:47:00,0:01:01
2012-11-07 12:47:00,0:01:24
2012-11-07 12:48:00,0:00:15
2012-11-07 12:48:00,0:00:20
2012-11-07 12:48:00,0:00:20
2012-11-07 12:48:00,0:00:18
2012-11-07 12:50:00,0:00:20
2012-11-07 12:50:00,0:00:32
2012-11-07 12:50:00,0:00:32
2012-11-07 12:55:00,0:01:30
2012-11-07 12:55:00,0:01:31
2012-11-07 12:55:00,0:00:17
2012-11-07 12:55:00,0:00:17
2012-11-07 12:55:00,0:00:18
2012-11-07 12:54:00,0:02:13
2012-11-07 12:59:00,0:36:03
2012-11-07 13:00:00,0:09:42
2012-11-07 13:00:00,0:13:35
2012-11-07 13:01:00,0:18:08
2012-11-07 13:01:00,0:28:37
2012-11-07 13:02:00,0:01:26
2012-11-07 13:02:00,0:00:01
2012-11-07 13:02:00,0:09:42
2012-11-07 13:03:00,0:04:53
2012-11-07 13:04:00,0:00:35
2012-11-07 13:12:00,0:14:28
2012-11-07 13:12:00,0:14:28
2012-11-07 13:12:00,0:14:42
2012-11-07 13:13:00,0:00:45
2012-11-07 13:14:00,0:01:27
2012-11-07 13:15:00,0:13:04
2012-11-07 13:14:00,0:13:08
2012-11-07 13:14:00,0:13:08
2012-11-07 13:14:00,0:15:32
2012-11-07 13:15:00,0:00:20
2012-11-07 13:15:00,0:00:30
2012-11-07 13:15:00,0:00:30
2012-11-07 13:16:00,0:00:42
2012-11-07 13:16:00,0:01:04
2012-11-07 13:17:00,0:02:01
2012-11-07 13:22:00,0:00:12
2012-11-07 13:24:00,0:00:02
2012-11-07 13:24:00,0:00:05
2012-11-07 13:24:00,0:00:05
2012-11-07 13:26:00,0:03:07
2012-11-07 13:27:00,0:00:41
2012-11-07 13:29:00,0:02:00
2012-11-07 13:30:00,0:00:17
2012-11-07 13:32:00,0:09:24
2012-11-07 13:32:00,0:25:47
2012-11-07 13:32:00,0:25:50
2012-11-07 13:32:00,0:25:50
2012-11-07 13:33:00,0:03:53
2012-11-07 13:38:00,0:00:01
2012-11-07 13:38:00,0:00:01
2012-11-07 13:39:00,0:27:03
2012-11-07 13:39:00,0:00:20
2012-11-07 13:39:00,0:01:02
2012-11-07 13:39:00,0:01:02
2012-11-07 13:40:00,0:00:00
2012-11-07 13:42:00,0:06:23
2012-11-07 13:42:00,0:00:15
2012-11-07 13:42:00,0:00:15
2012-11-07 13:42:00,0:06:55
2012-11-07 13:41:00,0:07:15
2012-11-07 13:45:00,0:00:33
2012-11-07 13:45:00,0:00:35
2012-11-07 13:46:00,0:01:12
2012-11-07 13:51:00,0:01:55
2012-11-07 13:53:00,0:02:02
2012-11-07 13:55:00,0:00:08
2012-11-07 13:55:00,0:03:42
2012-11-07 13:56:00,0:01:32
2012-11-07 14:01:00,0:00:54
2012-11-07 14:01:00,0:09:24
2012-11-07 14:01:00,0:09:27
2012-11-07 14:01:00,0:09:27
2012-11-07 14:02:00,0:35:17
2012-11-07 14:02:00,0:00:30
2012-11-07 14:02:00,0:35:48
2012-11-07 14:02:00,0:35:48
2012-11-07 14:02:00,0:01:00
2012-11-07 14:04:00,0:34:37
2012-11-07 14:04:00,0:34:37
2012-11-07 14:04:00,0:34:37
2012-11-07 14:05:00,0:04:38
2012-11-07 14:05:00,0:04:38
2012-11-07 14:05:00,0:04:43
2012-11-07 14:06:00,0:00:31
2012-11-07 14:08:00,0:13:06
2012-11-07 14:08:00,0:13:06
2012-11-07 14:06:00,0:01:15
2012-11-07 14:06:00,0:00:03
2012-11-07 14:06:00,0:00:03
2012-11-07 14:06:00,0:01:16
2012-11-07 14:06:00,0:00:03
2012-11-07 14:06:00,0:00:03
2012-11-07 14:06:00,0:00:03
2012-11-07 14:06:00,0:14:39
2012-11-07 14:06:00,0:00:34
2012-11-07 14:06:00,0:00:17
2012-11-07 14:06:00,0:00:21
2012-11-07 14:06:00,0:00:21
2012-11-07 14:07:00,0:11:06
2012-11-07 14:15:00,0:01:37
2012-11-07 14:15:00,0:01:53
2012-11-07 14:15:00,0:00:16
2012-11-07 14:14:00,0:02:19
2012-11-07 14:16:00,0:01:10
2012-11-07 14:19:00,0:04:45
2012-11-07 14:19:00,0:11:31
2012-11-07 14:21:00,0:00:04
2012-11-07 14:21:00,0:00:04
2012-11-07 14:21:00,0:00:00
2012-11-07 14:21:00,0:01:13
2012-11-07 14:21:00,0:00:04
2012-11-07 14:21:00,0:00:04
2012-11-07 14:21:00,0:01:13
2012-11-07 14:21:00,0:01:30
2012-11-07 14:21:00,0:01:43
2012-11-07 14:22:00,0:00:34
2012-11-07 14:23:00,0:03:41
2012-11-07 14:26:00,0:00:20
2012-11-07 14:26:00,0:00:45
2012-11-07 14:26:00,0:00:45
2012-11-07 14:26:00,0:15:39
2012-11-07 14:28:00,0:00:20
2012-11-07 14:28:00,0:02:04
2012-11-07 14:28:00,0:02:04
2012-11-07 14:30:00,0:08:36
2012-11-07 14:31:00,0:10:26
2012-11-07 14:43:00,0:01:16
2012-11-07 14:43:00,0:00:21
2012-11-07 14:43:00,0:01:41
2012-11-07 14:57:00,0:00:21
2012-11-07 14:58:00,0:03:41
2012-11-07 14:58:00,0:00:04
2012-11-07 14:58:00,0:00:04
2012-11-07 14:58:00,0:00:04
2012-11-07 14:58:00,0:00:04
2012-11-07 14:58:00,0:03:42
2012-11-07 14:58:00,0:00:04
2012-11-07 14:57:00,0:04:02
2012-11-07 14:58:00,0:00:20
2012-11-07 14:58:00,0:01:50
2012-11-07 14:58:00,0:01:50
2012-11-07 14:59:00,0:01:42
2012-11-07 14:59:00,0:01:46
2012-11-07 14:59:00,0:01:46
2012-11-07 14:59:00,0:19:45
2012-11-07 15:01:00,0:00:55
2012-11-07 15:02:00,0:00:10
2012-11-07 15:03:00,0:01:13
2012-11-07 15:04:00,0:42:23
2012-11-07 15:05:00,0:02:24
2012-11-07 15:05:00,0:00:36
2012-11-07 15:06:00,0:00:08
2012-11-07 15:06:00,0:00:41
2012-11-07 15:06:00,0:10:57
2012-11-07 15:06:00,0:11:00
2012-11-07 15:06:00,0:11:01
2012-11-07 15:13:00,0:01:42
2012-11-07 15:13:00,0:01:42
2012-11-07 15:13:00,0:00:22
2012-11-07 15:13:00,0:00:23
2012-11-07 15:13:00,0:00:23
2012-11-07 15:12:00,0:02:29
2012-11-07 15:15:00,0:00:19
2012-11-07 15:15:00,0:00:23
2012-11-07 15:15:00,0:00:23
2012-11-07 15:19:00,0:06:07
2012-11-07 15:22:00,0:00:20
2012-11-07 15:21:00,0:01:00
2012-11-07 15:21:00,0:01:00
2012-11-07 15:27:00,0:00:00
2012-11-07 15:27:00,0:00:00
2012-11-07 15:27:00,0:00:01
2012-11-07 15:27:00,0:00:01
2012-11-07 15:27:00,0:00:01
2012-11-07 15:28:00,0:00:01
2012-11-07 15:28:00,0:00:01
2012-11-07 15:28:00,0:01:13
2012-11-07 15:30:00,0:00:20
2012-11-07 15:30:00,0:00:33
2012-11-07 15:30:00,0:00:33
2012-11-07 15:30:00,0:13:31
2012-11-07 15:31:00,0:05:40
2012-11-07 15:31:00,0:05:43
2012-11-07 15:31:00,0:05:43
2012-11-07 15:35:00,0:18:18
2012-11-07 15:35:00,0:18:18
2012-11-07 15:35:00,0:18:18
2012-11-07 15:40:00,0:08:56
2012-11-07 15:40:00,0:08:59
2012-11-07 15:40:00,0:08:59
2012-11-07 15:46:00,0:18:07
2012-11-07 15:49:00,0:01:39
2012-11-07 15:49:00,0:01:40
2012-11-07 15:49:00,0:01:40
2012-11-07 15:48:00,0:01:59
2012-11-07 15:48:00,0:00:02
2012-11-07 15:50:00,0:00:03
2012-11-07 15:50:00,0:00:24
2012-11-07 15:50:00,0:01:17
2012-11-07 15:52:00,0:00:01
2012-11-07 15:52:00,0:01:24
2012-11-07 15:52:00,0:01:24
2012-11-07 15:52:00,0:01:43
2012-11-07 16:01:00,0:00:03
2012-11-07 16:01:00,0:00:02
2012-11-07 16:01:00,0:00:02
2012-11-07 16:02:00,0:00:34
2012-11-07 16:03:00,0:00:42
2012-11-07 16:05:00,0:00:20
2012-11-07 16:05:00,0:00:27
2012-11-07 16:05:00,0:00:27
2012-11-07 16:05:00,0:00:37
2012-11-07 16:14:00,0:00:55
2012-11-07 16:14:00,0:00:56
2012-11-07 16:14:00,0:00:17
2012-11-07 16:14:00,0:00:17
2012-11-07 16:14:00,0:00:17
2012-11-07 16:13:00,0:01:37
2012-11-07 16:16:00,0:01:01
2012-11-07 16:16:00,0:01:05
2012-11-07 16:16:00,0:01:05
2012-11-07 16:18:00,0:00:20
2012-11-07 16:18:00,0:00:30
2012-11-07 16:18:00,0:00:18
2012-11-07 16:18:00,0:00:18
2012-11-07 16:18:00,0:00:19
2012-11-07 16:17:00,0:00:52
2012-11-07 16:20:00,0:00:20
2012-11-07 16:20:00,0:01:41
2012-11-07 16:20:00,0:01:41
2012-11-07 16:41:00,0:25:43
2012-11-07 16:41:00,0:25:44
2012-11-07 16:41:00,0:00:16
2012-11-07 16:41:00,0:00:16
2012-11-07 16:41:00,0:00:17
2012-11-07 16:41:00,0:26:16
2012-11-07 16:50:00,0:00:36
2012-11-07 16:50:00,0:23:05
2012-11-07 16:54:00,0:01:07
2012-11-07 16:55:00,0:00:02
2012-11-07 16:55:00,0:00:02
2012-11-07 16:55:00,0:00:18
2012-11-07 16:59:00,0:01:08
2012-11-07 16:58:00,0:00:05
2012-11-07 16:58:00,0:00:51
2012-11-07 16:58:00,0:00:05
2012-11-07 16:58:00,0:00:05
2012-11-07 16:58:00,0:00:05
2012-11-07 16:58:00,0:00:05
2012-11-07 16:57:00,0:00:30
2012-11-07 16:57:00,0:00:30
2012-11-07 16:57:00,0:01:22
2012-11-07 16:57:00,0:02:55
2012-11-07 17:07:00,0:00:06
2012-11-07 17:07:00,0:02:47
2012-11-07 17:12:00,0:00:09
2012-11-07 17:12:00,0:00:10
2012-11-07 17:12:00,0:00:10
2012-11-07 17:12:00,0:00:28
2012-11-07 17:13:00,0:00:43
2012-11-07 17:14:00,0:02:13
2012-11-07 17:22:00,0:05:11
2012-11-07 17:23:00,0:00:27
2012-11-07 17:28:00,0:00:07
2012-11-07 17:38:00,0:01:25
2012-11-07 17:46:00,0:01:19
2012-11-07 20:34:00,0:00:20
2012-11-07 20:34:00,0:00:36
2012-11-07 20:34:00,0:00:37
2012-11-07 22:49:00,0:00:20
2012-11-07 22:49:00,0:00:29
2012-11-07 22:49:00,0:00:30
4

4 回答 4

3

对于日志中的每个呼叫,计算在该 call_datetime 处于活动状态的呼叫,然后找到最大值:

SELECT MAX(calls) FROM
(SELECT cl1.call_datetime, COUNT(*) AS calls
 FROM call_log cl1
 INNER JOIN call_log cl2
 ON cl1.call_datetime
 BETWEEN cl2.call_datetime  AND ADDTIME(cl2.call_datetime, cl2.call_length)
 GROUP BY cl1.call_id) AS counts;
于 2012-11-10T16:04:41.613 回答
1

SQL 小提琴演示

Demo 不包括您的所有数据(因为 sqlfiddle 上不允许使用超过 8000 个字符),但有一些示例数据

它显示了并发调用的最大计数

SELECT MAX(cnt) FROM
(SELECT cl1.b, COUNT(*) AS cnt
 FROM calls cl1
 INNER JOIN calls cl2
 ON cl1.b
 BETWEEN cl2.b  AND ADDTIME(cl2.b, cl2.c)
 GROUP BY cl1.a) AS counts;

和所有可能的计数。

SELECT cnt FROM
(SELECT cl1.b, COUNT(*) AS cnt
 FROM calls cl1
 INNER JOIN calls cl2
 ON cl1.b
 BETWEEN cl2.b  AND ADDTIME(cl2.b, cl2.c)
 GROUP BY cl1.a) AS counts;
于 2012-11-10T21:03:02.047 回答
0
select * from   
(
   select count(*), time(call_datetime) t0 from call_log    
   group by time(call_datetime)   
)  as q0 order by q0.t0 desc;

更改group by使用date, time, hour, min, sec等。

于 2012-11-10T13:36:16.900 回答
0

尝试为每个通话开始添加 +1,为每个结束添加 -1,然后只需获取该 +1/-1 列的累积总和
***如果需要,请转换通话日期或使用您的格式:

set @from:='2015-02-01';
set @to:='2015-03-01';
set @csum:=0;
SELECT DT,CallCount, (@csum := @csum + CallCount) as cumulative_sum
FROM 
(select calldate AS DT, 1 AS CallCount
 from cdr
 where calldate between @from and @to

 union all

 select ADDDATE(calldate,INTERVAL duration SECOND) AS DT, -1 AS CallCount
 from cdr 
 where calldate between @from and @to
  ) Calls
ORDER BY 1 asc;


我在这里给出了一个答案

于 2015-02-27T13:29:16.390 回答