select ccode, town, cYear, cMn as Period, UseGrp, cYr+cMn as tmpOrder, ; inlist(cMn,'03','06','09','12') as lQtr, cQtr as Qtr, ; count(price) as YtdNumSale, sum(price) as YtdVolSale ; from InputTable, tblMonths ; where cYear=cYr and cMnth between '01' and cMn ; group by 1, 2, 5, 6 ; into cursor curYtdMnResult && Month selections **** Some other intermediate queries and ** Now All Towns, counties - state level - specific UseGrp for i=13 to 15 select 'ZZ' as ccode, town, cYear, Period, UseGrp, ; sum(NumSales) as NumSales, sum(VolSales) as VolSales, ; sum(YtdNumSale) as YtdNumSale, sum(YtdVolSale) as YtdVolSale, ; MedSale, YtdMedSale ; from ('curFinalResult'+transform(i-6)) ; group by 3, 4, 5 ; into cursor ('curFinalResult'+transform(i)) && All ccode, All towns, specific UseGrp store _tally to ('lnTally'+transform(i)) nextNow, here I see ***** in YtdNumSale. I assume, integer can not handle the value this big.