Mega Code Archive

 
Categories / Oracle PLSQL / Insert Delete Update
 

Delete all records in TableA whose data in field1 and field2 DO NOT match the data in fieldx and fieldz of TableB

DELETE FROM TableA     WHERE NOT EXISTS       ( select *          from TableB          where TableA .field1 = TableB.fieldx          and TableA .field2 = TableB.fieldz );