Page 1 of 1

NorthEast US states IP addresses

PostPosted: Thu Apr 20, 2006 5:09 pm
by AussieWebmaster
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%

PostPosted: Fri Apr 21, 2006 4:04 pm
by robocoder
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');