Posted By

nkm on 09/28/09


Tagged

mysql records delete rows join orphan


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

kubaitis


Delete Orphaned Records


 / Published in: MySQL
 

URL: http://answers.yahoo.com/question/index?qid=20080708150528AAU33rq

  1. -- BACKUP, BACKUP, BACKUP!! --
  2.  
  3. DELETE
  4. FROM child_table
  5. WHERE id
  6. NOT IN
  7. (SELECT id FROM parent_table);

Report this snippet  

You need to login to post a comment.