Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Locate Nearest Data
Message
De
17/04/2008 12:11:29
 
 
À
16/04/2008 23:57:48
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP1
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01311354
Message ID:
01311477
Vues:
14
>What is your defenition of 'nearest' in this case?
>
>Dear Sir,
>
>I told it in my example.

>
>Suppose the data is as
>
>5
>6
>8
>9
>
>If text1 is equal to 7 then I want to get 6.
>I do not want 8


You told what you wanted. Better would be a description of how you determine this.

What if you have
1
2
3
4
9

and text1 is 8? Do you want 4 or 9?????
if text1 matches one of the values in the table do you want that value or the one "closest" one.

Assuming you want the closest value that is less than text1
SELECT MAX(myField) FROM myTable WHERE myField < m.myVar
might do the trick.

It appears from the original display that you might have character values. Bear in mind that "2" is greater than "123." If this isn't the behavior you want you will need to do something (convert to numeric or add leading zeros).
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform