I’m trying to get an id for a row in a lookup table based on an ip address. All ip’s are stored as varbinaries. The lookup table has ip ranges (start and end) and countries associated with the range. When I run the following query, I’m getting multiple rows. (1219006512 is the varbinary of an ip I’m trying to relate to the lookup table). Query follows:
SELECT * FROM lookup WHERE ('1219006512' >= start and '1219006512'<=end);
Here’s a screenshot of the results of the query run in phpmyadmin:
I get the same results with
SELECT * FROM lookup WHERE ('1219006512' between start and end);
Can someone explain why I’m getting multiple rows returned?