Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Looking for latest Date
Message
 
À
10/03/2005 14:59:33
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 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
00994588
Message ID:
00994625
Vues:
13
This message has been marked as the solution to the initial question of the thread.
>Hi,
>
>I'm trying to write a query to return records from a table that are closest to a certain date. I'm not sure what the syntax should look like in my SQL select statement. Any ideas would be greatly appreciated. Thanks!
>
>Tim

You need to be more explicit...
Something like:
*-- return 10 transaccions closest to Jan-15-2005
query_date = {^2005/15/01}
select top 10 trans_num, trans_date, (abs(trans_date-query_date)) as ndays ;
       from trans_table ;
       order by 3,1
or
*-- return transaccions within 3 days from Jan-15-2005
query_date = {^2005/15/01}
select trans_num, trans_date ;
       from trans_table ;
       where (abs(trans_date-query_date)) <= 3 ;
       order by 1

Just an opinion... Not a fact.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform