title: Folder and subfolders: how to query?
body: <p>i have got 2 tables which should show a folder structure as a tree. So every folder has an id and a name. if it is a subfolder of an other folder it has an parent id like this:</p>
  
  <p>Table folder:</p>
  
  <pre><code>Folderid name  
  11111112 xxy  
  11111113 yyy  
  11111114 yxy 
  </code></pre>
  
  <p>...</p>
  
  <p>table Structur</p>
  
  <pre><code>folderid parentid ...  
  11111112 NULL  
  11111113 11111112  
  11111114 11111113  
  </code></pre>
  
  <p>My question now is how can i check with a mysql query whether a folder is a subfolder of another (but it hasnt to be the parent one)</p>
  
  <p>For example:
  How can i check whether folder <code>11111114</code> is in <code>11111112</code>???
  I would check recursive but the problem is that the count is unkown so i downt now how often to do this step.</p>
  
  <p>maybe u can help me??</p>