SELECT ALL ; SUM( Production.paidamt ) AS nPaidAmount ; FROM ( ADDBS( lcLocationProduction ) + [Persons] ) AS ProductionMaster ; INTO CURSOR curAmountsPrevious ; WHERE ProductionMaster.campaign = lcCampaign ; AND ProductionMaster.intype = lcType ; AND BETWEEN( TTOD( ProductionMaster.tcurdate ), ; curDates.dPreviousPledgesStart, ; ldPledgesStop ; ) ; AND TTOD( ProductionMaster.paiddate ) <= ldPledgesStop ; GROUP BY intypeNow, they want to (quickly) add a count of the number of rows grouped to the SELECT statement (ie, "x" rows for this "intype" were what made up this "nPaidAmount" number). If this was SQL Server data, I'd do it with
COUNT(*) AS nPaidCount, ;just above the SUM() statement.