Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find the missing dates
Message
From
29/06/2008 07:00:30
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Vista
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01327505
Message ID:
01327506
Views:
20
This message has been marked as the solution to the initial question of the thread.
>How i can fine the missing dates. e.g In my dates field, there are dates like this. 01-01-2008,02-01-2008,03-01-2008,05-01-2008,.........
>I can fine the date 04-01-2008 from my records.(may many dates can be miss. thanks

Create a cursor, fill it with all dates int the period you want to test and then JOIN both tables. i.e you want to test period from 01/01/2008 to 31/12/2008:
CREATE CURSOR crsTest (Dt date)
ldStartDate = DATE(2008,1,1)
DO WHILE ldStartDate <= DATE(2008,12,31)
   INSERT INTO crsTest VALUES (ldStartDate)
   ldStartDate = ldStartDate + 1
ENDDO
INDEX ON Dt TAG crsTest

SELECT crsTest.Dt AS MissingDates;
FROM crsTest;
LEFT JOIN YourTable ON crsTest.Dt = YourTable.DateField;
WHERE  YourTable.DateField IS NULL;
INTO CURSOR crsMising
BROWSE NORMAL
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform