SELECT Id, EntryDate, TranDate, BatchId, EntityId, Count(*) AS Cnt; FROM Resh; WHERE Resh.Status == " " AND; BETWEEN(TranDate, dDateFrom, dDateTo); GROUP BY Resh.BatchId; ORDER BY &cSortOrder; INTO CURSOR Temp1