* Get the list of ID's to be deleted from table4 SELECT DIST t4.id ; FROM table4 t4 ; JOIN table3 t3 ON t3.id = t4.table3id ; JOIN table2 t2 ON t2.id = t3.table2id ; JOIN table1 t1 ON t1.id = t2.table1id ; JOIN deleteid did ON did.myid = t1.id ; INTO CURSOR crsDelIds * Delete DELETE FROM table4 ; WHERE id IN (SELECT id FROM crsDelIds)>I have table with 3 million lines and I have to delete about 2 million from this - based on other table with 200000 lines.
select deleteid >scan > select table1 > if seek (deleteid.myid,'table1','myid')=.f. > loop > endif > scan while deleteid.myid=table1.myid > select table2 > if seek (table1.dyid,'table2','dyid')=.f. > loop > endif > scan while table1.dyid=table2.dyid > select table3 > if seek (table2.id,'table3','table2id')=.f. > loop > endif > scan while table2.id=table3.table2id > select table4 > if seek (table3.id,'table4','table3id')=.f. > loop > endif > scan while table3.id=table4.table3id > delet in table4 > endscan > endscan > endscan > endscan >endscan>Thanks in advance