Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Join on inequality
Message
From
11/10/2001 11:18:26
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00566970
Message ID:
00567009
Views:
14
>I don't believe you can have the level of uncertainty you are hoping for in the join condition. Have you considered using BETWEEN() in the join condition.

Dore,

I think there is no uncertainty involved. Without SQL Syntax, I would use "SET NEAR OFF" and SEEK. In other words, what I want is: from a certain date, search backward for the closest date which is <= the comparison date. A single record has to be returned.

I need the closest matching date. Something like:
* Pseudocode?
select DateField from SecondTable where DateField <= MyDate into cursor Tmp
select max(MyDate) as DateMatch from Tmp into cursor Tmp
select * from SecondTable where DateField = Tmp.DateMatch into cursor Tmp
Come to think of it, perhaps I almost solved the problem already! But I don't know whether the above could be made shorter, or more efficient.

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform