Im trying to select an IP from a TEXT (details) type field, which works if I do this:
select id from `table` where `details` like '%192.168.0.1%' :
But If I want any record with an IP in that TEXT type field it seems a little tricky. I
have tried:
select id from `table` where INET_ATON(details) BETWEEN INET_ATON('127.0.0.1') and
INET_ATON('192.168.0.2');
select id from `table` where INET_ATON(details) BETWEEN INET_ATON('%127.0.0.1%') and
INET_ATON('%192.168.0.2%');
select id from `table` where details BETWEEN INET_ATON('%127.0.0.1%') and
INET_ATON('%192.168.0.2%');
For instance I know this IP is in 14 different records, what I was hoping for is a result
like so:
+----------+
| id |
+----------+
| 66 |
| 148 |
etc......
14 rows in set (0.01 sec)
Any other ideas on how I could do this?
Ron
| Thread |
|---|
| • Select IP from Text Type | Ron McKeever | 7 Mar |