title: Delete from table with foreign key
body: <p>Morning,</p>
  
  <p>I have three tables:</p>
  
  <p>Table: debtors</p>
  
  <pre><code>id           -    INT(11)
  type         -    ENUM('c', 'p')
  </code></pre>
  
  <p>Table: companies</p>
  
  <pre><code>id           -    INT(11)
  debtor_id    -    INT(11)
  and a lot of other fields for companies
  </code></pre>
  
  <p>Table: private_individuals</p>
  
  <pre><code>id           -    INT(11)
  debtor_id    -    INT(11)
  and a lot of other fields for private individuals
  </code></pre>
  
  <p>Foreign KEY SQL for companies(same is used for private individuals):</p>
  
  <pre><code>INDEX `fk_private_individual_debtors1` (`debtor_id` ASC) ,
    CONSTRAINT `fk_private_individual_debtors1`
      FOREIGN KEY (`debtor_id` )
      REFERENCES `application_user`.`debtors` (`id` )
      ON DELETE CASCADE
      ON UPDATE NO ACTION)
  </code></pre>
  
  <p>When I delete a company or private individual I want the debtor to be deleted as well and it should work the other way around aswell(delete a debtor and the company or private individual is deleted aswell).</p>
  
  <p>I'm thinking to do this with a trigger but I suppose there is a better way to do it..</p>
  
  <p>Can anyone help please?</p>