Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need SQL help for date/time record selection
Message
 
À
20/07/1998 10:19:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00119249
Message ID:
00119260
Vues:
21
>I need to be able to select records from a table based on a date/time range. The date & time are separate fields in the table with the date defined as an 8 position date field & the time as an 8 position character field. I need the record selection to be a single SQL command because I am retrieving the records into Lotus Notes via ODBC. The following command does not work, but I believe the logic is correct for what I am wanting:
>
>SELECT * FROM APDIST03;
> WHERE GLFYEAR = FiscalYear AND DTSTAT = " " AND;
> (ADDDATE = FromDate AND ADDTIME >= FromTime OR;
> ADDDATE = ToDate AND ADDTIME <= ToTime OR;
> ADDDATE >FromDate AND ADDDATE < ToDate)
>
>TIA for any suggestions! :)
If you mean by 'not work' you get the wrong answer then try someing like:
SELECT * FROM APDIST03;
WHERE GLFYEAR = FiscalYear AND DTSTAT = " " ;
AND (ADDDATE = FromDate AND ADDTIME >= FromTime);
OR (ADDDATE = ToDate AND ADDTIME <= ToTime);
OR (ADDDATE >FromDate AND ADDDATE < ToDate)
Where you place the () change the answer.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform