title: how to delete hierarchical parent and child record in store in same table
body: <pre><code>id name      parentid
   1 category     0
   2 question1    1
   3 type1        2
   4 type2        2
   5 question2    0
   6 type2        5
   7 type2        5
  </code></pre>
  
  <p>Where:</p>
  
  <ul>
  <li><em>category</em> is parent</li>
  <li><em>question1</em> and <em>question2</em> are childs</li>
  <li><em>type1</em>, <em>type2</em>, <em>type3</em> and <em>type4</em> are grandchilds</li>
  </ul>
  
  <p>I want to write a MySQL statement to delete the selected parent with all child records. How can I do that?</p>