Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004
    Location
    Oslo
    Posts
    45

    Arrow Unanswered: Including/Comparing massive amount of locations to ip-adresses in SQL Query. ??

    Well.. here i am again with another buggy question....

    Using a traffic counter which are using SQL DB for storing unique IP's.
    Now i got this MASSIVE list of locations which got different ip-ranges.

    What i basically need, is assistance with how to do this in the best way.
    I have to include it in the SQL query so that the last <td> is displaying the correct location for the ip-address.. (which means is between the ip-range ex : 162.156.72.000 and 162.156.73.000)

    The whole net got the same first 2 parts of the ip : 162.156.XXX.XXX, but the 2 last parts will ofcourse vary.

    I'm not sure how to do this the best way, since there's about 100 different ip-ranges, so therefore maybe 100 "if, then, else if's" or "Case"'s ?

    Might be a much better way but cannot figure out a better way though..
    Developed in A.S.P. btw..

    Can anyone enlighten me on this ?

    ------------------ WANNA-BE CODE --------------------
    ipLocation = IF fieldname BETWEEN 162.156.72.000 AND 162.156.73.000 THEN "Stockholm" IF fieldname BETWEEN etc.etc.etc..
    ------------------------------------------------------------

    Best regards
    Mirador

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: Including/Comparing massive amount of locations to ip-adresses in SQL Query. ??

    Sounds like you need another table, which stores the location name for each IP or IP range. Then just join to that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •