fix sql query for delete arch data mapping that are orphans