on-internet
← Community

oracle sql - delete rows with null value for every group

Stack Overflow ·

I try to delete rows with null values at the mail column, if and only if exists a row with a non-null value for the same person_id. DELETE FROM EMP_MAIL EM WHERE MAIL IS NULL AND EXISTS ( SELECT EMP_ID FROM EMP_MAIL EM2 WHERE MAIL IS NOT NULL AND EM.EMP_ID = EM2.EMP_ID ) ; but it takes quite a while. (i have an non-unique index on EMP_MAIL(EMP_ID)) is there a better way to preform this operation ?

Comments

Sign in or sign up to comment and upvote.

No comments yet.