else && we exceed original number of records, just select all records for that team select *, RECNO() as recnum from table1 WHERE AreaCode = m.lnAreaCode and Team = m.lnTeam into cursor crsRand NOFILTER endif ** Assuming that NewTable is our new table and it is already created and opened SELECT 2 USE table2 append from dbf("crsRand") delete from table1 where recno() in (select RecNum from crsRand)thanks