Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7750325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:15:42+00:00 2026-06-01T11:15:42+00:00

I have a log table containing user ids, ip addresses and log in datetimes.

  • 0

I have a log table containing user ids, ip addresses and log in datetimes. I need to find out who are the users who pretend to be other users by setting up multiple accounts.

This is my sample log table:

+---------+-------------+---------------------+
| 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 |
+---------+-------------+---------------------+

So, here is my question: how to select a list of user ids having the same ip address and with log in time difference of less than 5 minutes?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T11:15:43+00:00Added an answer on June 1, 2026 at 11:15 am

    How about something like this –

    SELECT *
    FROM log l1
    INNER JOIN log l2
        ON l1.ip_address = l2.ip_address
        AND l1.user_id < l2.user_id
        AND l1.login _time BETWEEN (l2.login_time - INTERVAL 5 MINUTE) AND (l2.login_time + INTERVAL 5 MINUTE)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a log table that records dates. I want to find out the
I have a table that functions as an event log and stores the users
I have a log table in my database which holds all user actions. In
I have a table, containing log entries. Is it possible to impose on it
I have two tables User & User Log . User log table basically logs
I have a table containing log entries for a single week for about a
I have a table that contains log entries for a program I'm writing. I'm
I have two tables user and log. I would like to join the user
I have a log table that contains job status. One of the columns is
I have a log table that is inherited by several tables: CREATE TABLE log

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.