title: Deleting Records based on relationship to other two tables
body: <p>I have three tables in MySQL, <code>table1</code>, <code>table2</code> and <code>table3</code>. table2 has foreign key of table1 while table3 has foreign key of table2 but not from table1. Structure is something like this:</p>
  
  <p>table1</p>
  
  <pre><code>Name   | type
  ------------------------
  d_id   | int
  d_name | varchar(100)
  </code></pre>
  
  <p>table2</p>
  
  <pre><code>Name   | type
  ---------------------------------------
  s_id   | int
  d_id   | int (foreign_key table1 d_id)
  s_name | varchar(100)
  </code></pre>
  
  <p>table3</p>
  
  <pre><code>Name    | type
  ----------------------------------------
  m_id    | int
  s_id    | int (foreign_key table2 s_id)
  m_value | int
  </code></pre>
  
  <p>I can easily select and join the information on these three tables but to delete base on similar join I just don't know how to do. This is how I did to select data.</p>
  
  <pre><code>SELECT * FROM table3 
  JOIN table2 ON table3.s_id = table2.s_id 
  JOIN table1 ON table2.d_id = table1.d_id
  </code></pre>
  
  <p>Now, I want to delete some values on table3 where table3 = table2 = table1 how do I do that?</p>