title: MySQL Nested Sets - How to find parent of node?
body: <p>I have your run of the mill nested set hierarchy type setup with the following columns:</p>
  
  <p>table name:</p>
  
  <pre><code>myset
  </code></pre>
  
  <p>columns:</p>
  
  <pre><code>id, name, lft, rgt
  </code></pre>
  
  <p>Does anyone know a query to determine the <em>parent</em> of a node?</p>
  
  <p>I read a couple places that it's handy to also have a <em>parent_id</em> column in your table to keep track of this, but it seems redundant and it seems like it could get out of sync with the nested set if a query was incorrectly executed when adding/removing/moving anything within the set.</p>