Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Date Range doesn't seem to work fully
Message
De
08/02/2008 17:45:41
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01290938
Message ID:
01290953
Vues:
14
>I am getting an incomplete SQL result.
>
>When I do a simple SQL in the Command Window with the date range and do not include any reference to the customer table, I seem to get 8 records, but when the customer reference is included, I only get 7 records. Now, what is strange is that the customer does exist and one of the good records in the 7 has the same customer, so the SQL should work, but it doesn't fully. The record dated for the 8th of Feb 2008, doesn't get picked up as a result. This is not a data type problem.
>
>Why the different result?
>
>
>WITH ThisForm
>   .dFrom=.txtStartdate.Value  && Used in report form.
>   .dThru=.txtEndDate.Value    && Used in report form.
> lcStartDate=DTOC(.txtStartdate.Value)
> lcStartDate=SUBSTR(lcStartDate,7,4) + ;
>      LEFT(lcStartDate,2) + ;
>      SUBSTR(lcStartDate,4,2)
>      lcEndDate=DTOC(.txtEndDate.Value)
>      lcEndDate=SUBSTR(lcEndDate,7,4) + ;
>      LEFT(lcEndDate,2) + ;
>      SUBSTR(lcEndDate,4,2)
>    SELECT ;
>        si.cust, ;
>        cs.customer, ;
>        si.StandsIn, ;
>        si.DateIn ;
>      FROM ;
>        STANDSIN si, ;
>        Customer cs ;
>      WHERE ;
>        BETWEEN(datein, .dFrom, .dThru) AND ;
>        si.cust = cs.custno ;
>      GROUP BY ;
>        si.Cust, ;
>        cs.customer, ;
>        si.standsin, ;
>        si.DateIn ;
>      ORDER BY cs.Customer ;
>      INTO TABLE C:\si_rpt
>
If the .datein field is a datetime, that'd explain why you aren'g getting anything for that date. It would be a few minutes and/or hours after today at 00:00, and your .dThru internally converts to {^2008-02-08 00:00:00}. So your last record would be AFTER your .dThru and would be excluded.

If .datein is a date, then... no clue here ;).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform