title: How to delete all rows from a table which references another table?
body: <pre><code>DELETE FROM hk_qa.shipping_order_lifecycle
  WHERE create_dt &lt; DATE_SUB(NOW(), INTERVAL 4 MONTH)
  </code></pre>
  
  <p>But its showing below error </p>
  
  <blockquote>
    <p>Cannot delete or update a parent row: a foreign key constraint fails
    (<code>hk_qa</code>.<code>lifecycle_reason</code>, CONSTRAINT
    <code>fk_lifecycle_reason_shipping_order_lifecycle1</code> FOREIGN KEY
    (<code>shipping_order_lifecycle_id</code>) REFERENCES <code>shipping_order_lifecycle</code>
    (<code>id</code>) ON DELETE NO ACT)</p>
  </blockquote>