title: Recursion On A Many To Many Table Parent To Child To Parent
body: <p>My boss has given me a single table.  </p>
  
  <pre>
  Related_Items_Table
  
  Item        | Accessory 
  ---------------------
  TV          | Antennae 
  TV          | Power Cord 
  TV          | Remote 
  Laptop      | Power Cord 
  Laptop      | Carrying Case 
  Camera      | Carrying Case 
  Camera      | Lens 
  iPod        | Headphones
  </pre>
  
  <p>The best way to describe what my boss wants for results is to walk through the process.  </p>
  
  <ol>
  <li><p>The user searches for TV.</p></li>
  <li><p>TV is found and the accessories for TV are Antennae, Power Cord &amp;
  Remote.  </p></li>
  <li><p>The accessories Antennae, Power Cord &amp; Remote are now used to find
      other related items.  Power Cord also an accessory for Laptop. 
      Antennae &amp; Remote are not accessories for any other item.</p></li>
  <li><p>The item Laptop is now used to find that item's accessories, which
          are Power Cord &amp; Carrying Case.</p></li>
  <li><p>The accessories Power Cord &amp; Carrying Case are now used to find
      other related items.  Power Cord finds no new items (we already know
      Power Cord is associated with TV &amp; Laptop).  Carrying Case is also
      an accessory for Camera.</p></li>
  <li><p>The item Camera is now used to find that item's accessories, which
      are Carrying Case &amp; Lens.</p></li>
  <li><p>The accessories Carrying Case &amp; Lens are now used to find other
      related items.  Carrying Case &amp; Lens find no new items (we already
      know Carrying Case is associated with Laptop).</p></li>
  <li><p>No new items are found to continue search chain.  Final list
      returned.</p></li>
  </ol>
  
  <pre>
  Final List 
  
  Item        | Accessory 
  ---------------------
  TV          | Antennae 
  TV          | Power Cord 
  TV          | Remote 
  Laptop      | Power Cord 
  Laptop      | Carrying Case 
  Camera      | Carrying Case 
  Camera      | Lens 
  </pre>
  
  <p>What is the best way to handle this problem?  I'm not sure what the correct terminology would be for this so perhaps I missed it in my searches.  Any advice is appreciated.</p>