Thanks Glyn, What you have given me works. I have taken it so now I get anything greater that one
select substring_index(ip,'.',3), count(*) from ips group by 1 having count(*) > 1 order by 2 desc limit 10; +---------------------------+----------+ | substring_index(ip,'.',3) | count(*) | +---------------------------+----------+ | 216.235.158 | 3 | | 218.1.65 | 2 | | 202.222.30 | 2 | | 66.232.140 | 2 | | 203.172.244 | 2 | | 61.146.178 | 2 | | 66.221.68 | 2 | | 200.62.177 | 2 | | 89.41.196 | 2 | | 193.221.125 | 2 | +---------------------------+----------+ 10 rows in set (0.01 sec) Again, thanks everyone... > I think you're after the SUBSTRING_INDEX(str,delim,count) function, so > (I've not tried this): > > select substring_index(ip,'.',3) from ipslimit 10; > > > --- On Wed, 23/7/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> > wrote: > >> From: [EMAIL PROTECTED] <[EMAIL PROTECTED]> >> Subject: Re: a question... >> To: "Daniel Brown" <[EMAIL PROTECTED]> >> Cc: [EMAIL PROTECTED], mysql@lists.mysql.com >> Date: Wednesday, 23 July, 2008, 5:10 PM >> Yes, sorry. I have a database that records ip of attacks on >> a customer >> server, what I like to do get a count so that I can see >> what subnet is >> doing the major of the attacks. >> >> select ip from ipslimit 10; >> +-----------------+-----------+ >> | ip | count(ip) | >> +-----------------+-----------+ >> | 83.117.196.206 | 1 | >> | 85.17.109.28 | 1 | >> | 125.138.96.19 | 1 | >> | 89.110.148.253 | 1 | >> | 192.168.105.10 | 1 | >> | 200.170.124.72 | 1 | >> | 201.116.98.214 | 1 | >> | 202.168.255.226 | 1 | >> | 203.89.243.158 | 1 | >> | 210.245.207.217 | 1 | >> +-----------------+-----------+ >> 10 rows in set (0.00 sec) >> >> >> >> > On Wed, Jul 23, 2008 at 11:45 AM, >> <[EMAIL PROTECTED]> wrote: >> >> Guys, >> >> >> >> I have been fighting with mysql trying to get it >> to only show every >> >> after >> >> the last dot(.) on a ip. for example >> >> >> >> instead geting 10.0.0.0 only get 10.0.0 >> > >> > As pulled from a database row? Sorry, I >> didn't quite understand your >> > email. >> > >> > -- >> > </Daniel P. Brown> >> > Better prices on dedicated servers: >> > Intel 2.4GHz/60GB/512MB/2TB $49.99/mo. >> > Intel 3.06GHz/80GB/1GB/2TB $59.99/mo. >> > Dedicated servers, VPS, and hosting from $2.50/mo. >> > >> >> >> >> -- >> MySQL General Mailing List >> For list archives: http://lists.mysql.com/mysql >> To unsubscribe: >> http://lists.mysql.com/[EMAIL PROTECTED] > > > __________________________________________________________ > Not happy with your email address?. > Get the one you really want - millions of new email addresses available > now at Yahoo! http://uk.docs.yahoo.com/ymail/new.html > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]