Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Range grouping
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01472288
Message ID:
01472419
Views:
27
You need to have indexes on IPField and Field1/Field2. You may also re-write it as
IPField >=Field1 and IPField<=Field2
I'm not sure you can fully optimize such join condition.

>Thanks, works perfect. Any indexing tips to make the query somewhat faster?
>
>>>Hi all,
>>>
>>>I have a table (wwrequestlog) of web hits with the corresponding ip-addresses (field remoteaddr).
>>>Another table (iptocountry) contains two numeric fields (field1, field2), a range of ip-addresses with the corresponding country (field3).
>>>
>>>I want to make a query where for each hit in wwrequestlog where the corresponding country is searched. For example:
>>>
>>>field1 field2 country
>>>411303936 411369471 NL
>>>540711936 540712447 NL
>>>1042299392 1042300159 SP
>>>
>>>..
>>>
>>>table wwrqeustlog
>>>
>>>remoteaddr ...
>>>540711938
>>>..
>>>result of query
>>>540711938 NL
>>>
>>>Thanks beforehand
>>
>>Try:
>>
>>
>>Select L.RemoteAddr as IP, C.Country from WWRequestLog L 
>>LEFT JOIN IPToCountry C on L.Ip between C.Field1 and C.Field2
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform