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]