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" <[EMAIL PROTECTED]>
To: <mysql@lists.mysql.com>
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


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

Reply via email to