delete v
from
vdds v
join (SELECT 'bEmployee' as datatype, 1 as b, Instance, SecurityGroup
FROM vDDDS
WHERE (Datatype = 'bEmployee') AND
(Qualifier = 1) AND
(SecurityGroup BETWEEN 1 AND 4) AND
Instance NOT IN (
SELECT CAST(Employee AS char)
FROM PREH
WHERE PRCo = 1 AND
PRGroup = vDDDS.SecurityGroup
)
) x on v.columnname = x.columnname
not sure what your names are in your table