Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Join on inequality
Message
De
11/10/2001 11:18:26
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
11/10/2001 11:08:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00566970
Message ID:
00567009
Vues:
15
>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)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform