1. DELETE FROM
  2. B
  3. WHERE NOT EXISTS(
  4. SELECT 1
  5. FROM
  6. A
  7. WHERE
  8. B.id=A.id
  9. )


B.id = A.id 就是A, B表主外键关系的字段。