Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Date Range doesn't seem to work fully
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
SQL Date Range doesn't seem to work fully
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01290938
Message ID:
01290938
Views:
54
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
Next
Reply
Map
View

Click here to load this message in the networking platform