NorthEast US states IP addresses

General Discussion about IP Address Lookup caveats, technology, ideas, etc.

Moderator: Moderators

NorthEast US states IP addresses

Postby AussieWebmaster on Thu Apr 20, 2006 5:09 pm

I need the IP addresses of the northeast states of US - what is best way to get the?

Obviously as accurate as possible but know they are not much over 85%
AussieWebmaster
n00b
 
Posts: 1
Joined: Thu Apr 20, 2006 5:06 pm

Postby robocoder on Fri Apr 21, 2006 4:04 pm

This will depend on your RDBMS and version. For example, earlier versions of MySQL didn't support subselects (aka sub-queries). See if any of the following examples work for you. (Note: performance may also differ greatly.)

Example 1 (using subselect):
Code: Select all
select ip from ip4 where city in
    (select city from cityByCountry where state in
        ('Connecticut','Maine','Massachusetts','New Jersey',
         'New Hampshire','New York','Pennsylvania',
         'Rhode Island','Vermont'));

Example 2 (using inner join):
Code: Select all
select ip from ip4, cityByCountry where
    ip4.city = cityByCountry.city and
    cityByCountry.state in
        ('Connecticut','Maine','Massachusetts','New Jersey',
         'New Hampshire','New York','Pennsylvania',
         'Rhode Island','Vermont');
User avatar
robocoder
Veteran
 
Posts: 105
Joined: Sat Mar 25, 2006 8:10 pm
Location: Ontario, Canada


Return to IP Address Lookup

Who is online

Users browsing this forum: No registered users and 2 guests

cron