Hi, I tried this and it seems to work:
SELECT SUBSTRING_INDEX(INET_NTOA(ip), '.',3) AS addr, COUNT(*) AS addrsum FROM
ips GROUP BY addr;
Perhaps you don't have your IP adresses stored as integers but instead as
text. Then the following query is for you!
Your query:
SELECT ip, COUNT(*) from tbl_
Hello everyone,
I have a mysql table tha holds a variety of ip address. I am trying
to work out a select statement that will give me a count(*) grouped by
the first 2 octets of the ip.
if the ip table contains:
10.102.1.1
192.168.123.34
192.168.123.4
192.168.123.43
192.168.123.3
192.168.0.27