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 8617613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:54:11+00:00 2026-06-12T05:54:11+00:00

I have a table with usernames and IPs. I need to get a list

  • 0

I have a table with usernames and IPs.
I need to get a list of the users who have similar IP –ignore last 3 or 2 or 1 digit(s)–

Example:
Count 190.200.210.180 and 190.200.210.60 as the same IP.
Count 205.50.4.30 and 205.50.4.197 as the same IP.

The field type of IPs is set as varchar and this is something I cannot change at the moment.

Currently I’m using :

SELECT GROUP_CONCAT( username ) names, IPs, COUNT( IPs ) AS Instances 
FROM users
GROUP BY IPs
HAVING (COUNT(IPs) >1)
ORDER BY  `Instances ` DESC 

to get the users with the same IP.
SQL statement output

Is it possible with the field of the IPs being set as varchar to make a select statement to group users with similar ips?

Thank you in advance for your help.

  • 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-12T05:54:13+00:00Added an answer on June 12, 2026 at 5:54 am

    Try this:

    SELECT 
        GROUP_CONCAT(username) AS names, 
        SUBSTRING_INDEX(IPs, '.', 3) AS IPs
        COUNT(*) AS Instances 
    FROM
        users
    GROUP BY 
        SUBSTRING_INDEX(IPs, '.', 3)
    HAVING
        COUNT(*) > 1
    ORDER BY
        Instances DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three records in a table example: *Usernames* *email* *city* Nick nick@example.com London
I have this table for users that stores their usernames and other data, thats
I have table users with columns id, username, email and password. And i have
I have Two tables. 1.Users table (Username , Name) 2.Picture table( ID , Username
i have a table that holds my users information like username , password ,
I have a table with unique usernames and a bunch of string data I
In Oracle db we have a table with varchar2 type of column (for example
I have a query in my application that selects users from a table by
I have a CSV file with a list of banned usernames --it's about 10,000
So I have this function that takes all the users from an MySql table

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.