title: Can someone help me understand pivot tables in layman terms?
body: <p>I think my problem calls for a pivot table but I want to be clear before spending a huge amount of time trying to implement. I have not yet used pivot tables for any projects.</p>
  
  <p>I have a new project that contains multiple "kits" that have common "parts" among them and in some cases a part can be interchanged with those for another kit. Likewise not all parts are compatible with one another.</p>
  
  <p>Rather than having to create some nightmarish SQL query I was hoping to essentially build a table that would store compatibility information to make cross referencing a simple SQL query. </p>
  
  <p><strong>Example:</strong> </p>
  
  <pre><code>SELECT kitID FROM crossRefTable WHERE partA, partC and partE are true.
  </code></pre>
  
  <p><strong>Or for example:</strong> </p>
  
  <pre><code>SELECT partID FROM crossRefTable WHERE partA and partE are true.
  </code></pre>
  
  <p>(Yes, the SQL queries are exmple only for stressing the point)</p>
  
  <p>I am not sure that the "<strong>belongTo</strong>" and "<strong>hasMany</strong>" necessarily apply here or if so how would that be implemented?</p>
  
  <p>Coding is in <strong>PhalconPHP</strong> using <strong>MongoDB</strong>.</p>
  
  <p>Thank you for your thoughts and suggestions.</p>
  
  <p>Steven</p>