Here is one technique I was exploring, which I could not figure out, with the ip-group-country table. Given that several countries are contiguous in the ip range I wanted to group by these and get the MAX, MIN ip-start and then I would only have to check the "between" ranges of about half of the 180,000 rows. I've tried every combination of ranking functions to no avail. Here is what I want: how to calculate the second column below so I can group on it!
US 1 US 1 CA 2 IN 3 US 4 CA 5 CA 5 DE 6 DE 6 US 7