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
192.168.0.212
10.102.1.54
10.102.1.75
10.102.1.62
10.102.1.12
10.102.1.10
10.102.1.111

how can my:
SELECT ip, COUNT(*) from tbl_MasterIp group by ip;

be changed so that I get back

   ip        COUNT(*)
10.102.1       20
192.168.123    30
192.168.0      10

or whatever the ip counts  should be.  I have about 5 different octets
within this table.

I am using mysql 3.*

Thanks for any help...



Sincerely,
Chad


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to