Select yearmonth, count(*) as Rank, 000 AS MaxMiniMonth from mytable group by yearmonth ORDER BY 2 DESC INTO CURSOR Result READWRITE lnRecs = RECCOUNT()+1 REPLACE MaxMiniMonth WITH m.lnRecs-RecNo() ALL>Yes, this will works, but you the ORDER must be BY first field. Also we don't knwo what version of VFP Paul use. If He use VFP7 or smaller He doesn't have READWRITE option to SELECT. I don't know what you didn't like in my suggestion, sooo many functions and calculations are involved :o))) (just joke). Also it is easier to:
>REPLACE MaxMiniMonth WITH RECOUNT()-RecNo()+1 ALL >** or faster >lnRecs = RECCOUNT()+1 >REPLACE MaxMiniMonth WITH m.lnRecs-RecNo() ALL >>
>>Select yearmonth, 000 AS MaxMiniMonth from mytable group by yearmonth ORDER BY 2 DESC INTO CURSOR Result REARWRITE >>lnRecs = RECCOUNT("Result") >>SCAN >> REPLACE MaxMiniMonth WITH lnRecs >> knRecs = lnRecs - 1 >>ENDSCAN >>>>
>>>YearMonth MinMax >>>--------------------- >>>200609 2 >>>200608 2 >>>.... >>>>>>
>>>>Select yearmonth, COUNT(*) AS MaxMiniMonth from mytable group by yearmonth ORDER BY 2 DESC >>>>>>>>