Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Month repartition from two dates
Message
De
13/07/1997 13:04:54
 
 
À
13/07/1997 12:54:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00039620
Message ID:
00039757
Vues:
37
>>> SELECT ADDDATE FROM THREAD;
>>> WHERE NOMEMBER=lnNumero AND NOCLIENT=lnWeb;
>>> ORDER BY 1 INTO CURSOR TEMP
>>>
>>> This will be a direct result giving me all the dates for a user in a
>>> specify forum. So, after this SQL, I now have my first date. Doing GO
>>> BOTTOM, will give the last date.
>>>
>>> There I have the first and last date which I then use for the month/year
>>> repartition.
>>>
>>
>>Let's give it a try, say you've filled the end_date
>>
>>Go Top
>>first_o_month=adddate-day(adddate)+1
>>* this is the day 1 of the beginning month, really
>>last_o_month=GoMonthfirst_o_month,1)-1
>>do while last_o_month>> select * from temp where adddate between first_o_month and
>>last_o_month;
>> into bla bla
>> first_o_month=GoMonth(First_o_month,1)
>> last_o_month=GoMonthfirst_o_month,1)-1
>>enddo
>
>Thanks, but I wrote something simplier.
>
>I first use Paul's formula to get the number of months between two dates. So, this will give me my counter for the FOR NEXT. I also start with the highest date.
>
>FOR lnCounter=1 TO lnNumberMonths
>
>Then, I can do a count for the number of messages from the highest date.
>
>COUNT FOR ADDDATE>=ldDate2 AND ADDDATE<=GOMONTH(ldDate2,1)-1 TO lnMessage
>
>Then, after my processing, for the next FOR loop, I need to remove one month from the highest date.
>
>ldDate2=GoMonth(ldDate2,-1)
>
>And, the loop continues...

Are you doing this on a cursor that contains only the messages for the specified user or on the whole dbf?

Vlad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform