Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SELECT last month not found?
Message
De
13/12/2004 20:25:51
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
13/12/2004 19:40:41
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 8 SP1
OS:
Windows XP SP1
Divers
Thread ID:
00968941
Message ID:
00968965
Vues:
7
In this case, I think you should have a table of months, and use a subquery with NOT IN.

>First of all, I apologize for not previewing my original message, which is embarrassing. This is what I meant to say:
>-------------------
>A simple case: I have a table with two relevant fields, {partno} and {month} (month is represented as YYYYMM). This table has history for each part, starting from the current month and going back to some date in the foggy past.
>
>For each partno, how do I determine the last {month} for each part that is NOT found in the table?
>-------------------
>
>If I have history for 200403, 200405, 200408, 200410, 200411, and 200412, for instance, I would be looking for 200409, which is the most recent month for which there is no data for this part.
>
>Jim
>
>>
>>Jim,
>>
>>I'm not sure I understand you correctly but would this work for you (pseudo code)?
SELECT partno, MAX(GOMONTH(YYYYMM, 1)) AS lastmonsplusone ;
>>...
>>GROUP BY partno
>>
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform