The CTE table only exists for the first DELETE and is no longer available for the second. You should use a #TempTable or @VariableTable to collect deleted EmpIds. After that, you can use that table for joining and deleting rows that match with EmpIds.