title: DELETING using Inner join
body: <p>I followed how to execute delete from: <a href="https://stackoverflow.com/questions/16481379/how-to-delete-using-inner-join-with-sql-server">How to Delete using INNER JOIN with SQL Server?</a></p>
  
  <p>The data I want to delete:</p>
  
  <pre><code>  select * from com.Address a
    inner join com.Contact as c on c.AddressId = a.AddressId
    inner join cqt.CQMTrainer as t on t.ContactId = c.ContactId
  
  
   select from com.Contact c
    inner join cqt.CQMTrainer as t on t.ContactId = c.ContactId 
  </code></pre>
  
  <p>Here is the delete I am trying to execute:</p>
  
  <pre><code>  delete a from com.Address a
    inner join com.Contact as c on c.AddressId = a.AddressId
    inner join cqt.CQMTrainer as t on t.ContactId = c.ContactId
  
    delete c from com.Contact c
    inner join cqt.CQMTrainer as t on t.ContactId = c.ContactId 
  </code></pre>
  
  <p>However, once I execute them I got some foreign key error:</p>
  
  <blockquote>
    <p>The DELETE statement conflicted with the REFERENCE constraint
    "FK_com.Contact_com.Address_AddressId". The conflict occurred in
    database "", table "com.Contact", column 'AddressId'. </p>
  </blockquote>
  
  <p>What am I following incorrectly? I even tried adding <code>begin transaction</code> and <code>commit transaction</code>.</p>