MySQL Forums
Forum List  »  InnoDB

Re: Regex first three octets
Posted by: Alfonso Caponi
Date: October 20, 2008 08:58AM

William Chiquito Wrote:
-------------------------------------------------------
> Hi alfonso,
>
> An option is:
>
> SELECT LEFT(ip, CHAR_LENGTH(ip) - LOCATE('.',
> REVERSE(ip))) FROM tablename;
>

Thank you very much William.

And to count occurences number too?

A wrong attempt:

SELECT classes,count((LEFT(ip, CHAR_LENGTH(ip) - LOCATE('.', REVERSE(ip))))) as classes FROM tbl_eventi;

Options: ReplyQuote


Subject
Views
Written By
Posted
5834
October 20, 2008 06:37AM
2843
October 20, 2008 08:08AM
Re: Regex first three octets
2852
October 20, 2008 08:58AM
2948
October 21, 2008 03:32AM
5752
December 01, 2008 05:45PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.