con using.
ej:
delete from fprofiles prof
using ((select p.* from fprofiles p where p.subcontractordetailid < 300)
EXCEPT
(select p.* from fprofiles p
inner join fcontactpersons cp on cp.subcontractorid = p.subcontractorid
inner join fcontactpersondetails cpd on cpd.contactpersonid = cp.personid
where true
and p.subcontractordetailid = cpd.detailid
and p.type = cpd.type
)) as t
where prof.organizationid = t.organizationid and
prof.subcontractorid = t.subcontractorid and
prof.subcontractordetailid = t.subcontractordetailid and
prof.type = t.type
;
No hay comentarios:
Publicar un comentario