我有一个包含用户 ID、IP 地址和登录日期时间的日志表。我需要通过设置多个帐户来找出谁是冒充其他用户的用户。
这是我的示例日志表:
+---------+-------------+---------------------+
| user id | ip address | log in datetime |
+---------+-------------+---------------------+
| 17 | 192.168.1.4 | 2012-04-01 00:01:00 |
+---------+-------------+---------------------+
| 21 | 192.168.1.2 | 2012-04-01 00:02:00 |
+---------+-------------+---------------------+
| 11 | 192.168.1.5 | 2012-04-01 00:06:00 |
+---------+-------------+---------------------+
| 1 | 192.168.1.3 | 2012-04-01 00:09:00 |
+---------+-------------+---------------------+
| 3 | 192.168.1.3 | 2012-04-01 00:15:00 |
+---------+-------------+---------------------+
| 8 | 192.168.1.5 | 2012-04-01 00:22:00 |
+---------+-------------+---------------------+
| 9 | 192.168.1.1 | 2012-04-01 00:26:00 |
+---------+-------------+---------------------+
| 13 | 192.168.2.1 | 2012-04-01 00:27:00 |
+---------+-------------+---------------------+
| 2 | 192.168.1.1 | 2012-04-01 00:28:00 |
+---------+-------------+---------------------+
| 33 | 192.168.1.7 | 2012-04-01 00:30:00 |
+---------+-------------+---------------------+
| 27 | 192.168.1.1 | 2012-04-01 00:31:00 |
+---------+-------------+---------------------+
| 22 | 192.168.1.7 | 2012-04-01 00:45:00 |
+---------+-------------+---------------------+
所以,这是我的问题:如何选择具有相同IP地址且登录时间差小于5分钟的用户ID列表?