>FOR nMonth = 1 TO 12 > lcMonth = GetAlphaMonth(nMonth) > ldDate = date(2010,nMonth,1) && First Day of the month > > ldStartOfMonth=ldDate > ldStartOfNextMonth=GOMONTH(ldDate,1) && First day of next month > > SELECT lcMonth+" 2010" AS Month_Year, ; > GrpID, Emp_ID, ; > SUM(bill_prem) AS Month_Billed, ; > BnftName, ; > 0000000.00 AS Month_Collected ; > FROM tmp1 ; > WHERE bill_date>= ldStartOfMonth and bill_date<ldStartOfNextMonth ; > INTO CURSOR ("tmp" +alltrim(str(nMonth))); > GROUP BY GrpID, Emp_ID, BnftName > >ENDFOR >