• There are a number ways you could, do this. You could get the list of your duplicates first, and insert them into a dataset, for example a temporary table. You can then use that to define the records that are deleted in your first table, and then use the same data to do your logic on your second.

    You could, also, use Lowell's solution, and output that data (using OUTPUT and  INTO) into a dataset, then use that dataset to do your second logic.

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk