I have a table which stores a ID
, Name
, Code
, IPLow
, IPHigh
such as:
1, Lucas, 804645, 192.130.1
select *
from ip a
join ip_details b
on a.ip_address >= b.ip_start
and a.ip_address <= b.ip_end;
In this, table "a" contains list of IP address and table "b" contains the IP ranges.
Instead of converting the ip address to numeric we can directly compare the string, it will do a byte by byte comparison.
This is working for me(PostgreSQL).