Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Find the missing dates
Message
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 9 SP1
OS:
Vista
Database:
Visual FoxPro
Divers
Thread ID:
01327505
Message ID:
01384869
Vues:
45
>>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
>
Borislav,

I just found this http://blog.sqlauthority.com/2008/04/22/sql-server-better-performance-left-join-or-not-in/ Very interesting.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform