List:General Discussion« Previous MessageNext Message »
From:Rhino Date:March 24 2006 9:07pm
Subject:Re: Comparing x.x.x.x strings
View as plain text  
I don't know the answer to your question but I know that this issue has been 
discussed in this mailing list before. Look in the MySQL archives and I'm 
sure you will find an answer on the best way to compare IP addresses.

--
Rhino

----- Original Message ----- 
From: "Lucas Vendramin" <lucas.vendramin@stripped>
To: <mysql@stripped>
Sent: Friday, March 24, 2006 3:44 PM
Subject: Comparing x.x.x.x strings


Hi all.
I have a problem:
When I compare two strings in mask (x.x.x.x) the comparation is not true 
(for my question :D)... look:
 select '3.2.0.13' > '3.2.0.2'            -> FALSE
I want this command return TRUE, but it is returning FALSE.
But, if I put a space first into the smaller string the camparation will 
returns what I want:
 select '3.2.0.13' > ' 3.2.0.2'            -> TRUE

How can I check it? There is a way to correct my problem? The string is like 
a IP-ADDRESS where 192.168.0.13 is better than 192.168.0.2, but it is not a 
IPADDRESS column, it is a Version of file (version 3.2.0, version 3.2.1, 
etc...)

Thanks for all.


--------------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.1/291 - Release Date: 24/03/2006



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.1/291 - Release Date: 24/03/2006

Thread
Comparing x.x.x.x stringsLucas Vendramin24 Mar
  • Re: Comparing x.x.x.x stringsRhino24 Mar
    • Re: Comparing x.x.x.x stringsPeter Brawley25 Mar
  • Re: Comparing x.x.x.x stringsJay Paulson24 Mar
    • Re: Comparing x.x.x.x stringsLucas Vendramin27 Mar
      • Re: Comparing x.x.x.x stringsJake Peavy27 Mar
  • Re: Comparing x.x.x.x stringsDan Nelson24 Mar