>I have a cursor with the following three fields: Part, Month (YYYYMM) and Sales.
>
>The combination of Part + Month is unique, as that has been previously calculated, and there are no records for months where Sales = 0
>
>I need to calculate the sum of sales for the first twelve months that occur in this cursor for each part, answering the question "For each part, what is the total sales for the first twelve months in which sales occurred, recognizing that they might not be consecutive?".
>
>Is there a way to do this in a single statement?
This is very simple in SQL Server 2005 and up, but quite complex in VFP. It was discussed here before.
See
Re: SPT Syntax Thread #
1548842 Message #
1548907
If it's not broken, fix it until it is.
My Blog