RE: IP Address Operations in MySQL

2003-09-23 Thread Chris
you can also convert the ip to an ip number and store it that way.

makes it easier so you don't have do deal with a octete'd number

:)


> -Original Message-
> From: Hassan Schroeder [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, September 23, 2003 1:57 PM
> To: MySQL Mailing List
> Subject: Re: IP Address Operations in MySQL
> 
> 
> Aaron Clausen wrote:
> 
> > I'm running 3.23.49 on a Win2k machine and wonder if anybody has 
>  > some advice on how to write queries dealing with IP addresses.
>  > Specifically, I have a table with an ip address field. I want to
>  > be able to do queries based on subnet. Has anybody got anyting
>  > like this?
> 
> Yes, REGEXP / RLIKE will work fine for this -- for example:
> 
>SELECT hostname, ip FROM addr WHERE ip RLIKE '^192.168.10.[0-9]+$';
> 
> HTH!
> -- 
> Hassan Schroeder - [EMAIL PROTECTED]
> Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
> 
>dream.  code.
> 
> 
> 
> 
> -- 
> 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]



Re: IP Address Operations in MySQL

2003-09-23 Thread Hassan Schroeder
Aaron Clausen wrote:

I'm running 3.23.49 on a Win2k machine and wonder if anybody has 
> some advice on how to write queries dealing with IP addresses.
> Specifically, I have a table with an ip address field. I want to
> be able to do queries based on subnet. Has anybody got anyting
> like this?
Yes, REGEXP / RLIKE will work fine for this -- for example:

  SELECT hostname, ip FROM addr WHERE ip RLIKE '^192.168.10.[0-9]+$';

HTH!
--
Hassan Schroeder - [EMAIL PROTECTED]
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
  dream.  code.



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


IP Address Operations in MySQL

2003-09-23 Thread Aaron Clausen
I'm running 3.23.49 on a Win2k machine and wonder if anybody has some advice on how to 
write queries dealing with IP addresses.  Specifically, I have a table with an ip 
address field.  I want to be able to do queries based on subnet.  Has anybody got 
anyting like this?

--
Aaron Clausen

[EMAIL PROTECTED] or [EMAIL PROTECTED]

--

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