Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select dates in a range not in a query.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00319335
Message ID:
00319341
Vues:
11
Martin,

I'll assume that your main data table has a field called TranDate

Essentially, I'd populate a cursor with all the dates in the range and then find what's missing from the main table.

I'll hard-code the dates you've used below
CREATE CURSOR DateRange (TranDate D)
FOR nOffset = 0 to ({^1999-11-30} - {^1998-12-01} - 1)
   INSERT INTO DateRange VALUES ({^1998-12-01} + nOffset) 
ENDFOR

SELECT DateRange.TranDate ;
  FROM DateRange ;
  WHERE DateRange.TranDate NOT IN (SELECT DISTINCT TranDate FROM MainDataTable) ;
  INTO ...
Cheers,

Andrew

>I need to create a query that will return mssing dates within a range.
>e.g. Between the 01/12/1998 and 30/11/1999 - say there is no data for the first two weeks of december 98. I need to know which dates are missing to run a routine to 'patch' in this mssing data from dates that do contain data.
>
>Any ideas?


If we were to introduce Visual FoxBase+, would we be able to work from the dotNet Prompt?


From Top 22 Developer Responses to defects in Software
2. "It’s not a bug, it’s a feature."
1. "I thought I fixed that."


All my FoxTalk and other articles are available on my web site.


Unless specifically identified otherwise, anthing posted here is purely my opinion and may or may not reflect the policies or practices of Microsoft.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform