>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:
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)