>ccode C2 town C4 UseGrp C3 cYear c4 Period C2 other numeric values >>
>select ccode, town, UseGrp, cYear, ; > VolSales, MedSale, NumSales ; > from InputTable ; > where town='ZZZZ' and ; > Period='YR' and between(cYear,lcStartYear,lcEndYear) ; > into cursor curTemp && This cursor would contain all necessary records in the ascending order (Since the stats table was prepopulated) >?_Tally
> select distinct curTemp.ccode, nvl(State,lcState) as State, ; > nvl(upper(County),lcCounty) as County, ; > nvl(fullname,lcCity) as City, ; > curTemp.town, UseGrp, cYear, ; > VolSales, MedSale, NumSales ; > from curTemp left join Towns ; > on curTemp.ccode=Towns.ccode ; > order by 1,5,6,7 ; > into cursor curWork>