Search PHPMYADMIN Database for similar entrys

前端 未结 3 1985
长情又很酷
长情又很酷 2021-01-17 00:23

So i have database with a table called users.. and in that table there is a column named IP and i want to find users with the same IP and ban them.. So how can a search the

3条回答
  •  Happy的楠姐
    2021-01-17 01:00

    You should leverage the group by query. An old blog I wrote is Understanding group bys

    But basically this should work:

    select distinct ip, count(id) from users group by IP having count(id) > 1
    

    This will return all ip addresses with a count of > 1

提交回复
热议问题