title: Select Parent node in nested data set
body: <p>Have teh follwoing query which is fine and dandy...</p>
  
  <pre><code>SELECT
      `node`.`site_pages_id` AS `page_id` ,
      GROUP_CONCAT(`parent`.`site_pages_id` SEPARATOR '/') AS `path` ,
      IFNULL( CONCAT( '/' , GROUP_CONCAT(`parent`.`url` SEPARATOR '/') ) , '/' ) AS `url`
  FROM
      `site_pages` AS `node`
  LEFT JOIN
      `site_pages` AS `parent`
  ON
      `node`.`lft_limit` BETWEEN `parent`.`lft_limit` AND `parent`.`rgt_limit`
  GROUP BY
      `node`.`site_pages_id`
  ORDER BY
      `node`.`lft_limit` ASC
  </code></pre>
  
  <p>produces the following</p>
  
  <pre><code>1, 1,     /
  2, 1/2,   /about-us
  8, 1/2/8, /about-us/meet-the-team
  3, 1/3,   /web
  5, 1/5,   /print
  6, 1/6,   /branding
  7, 1/7,   /contact-us
  </code></pre>
  
  <p>All sweet.</p>
  
  <p>I'd like to select the immediate parent and just the immediate parent for each node.</p>
  
  <p>My feeble attempts at doing so without a nasty subquery fail misearably (not much better with TBO).</p>
  
  <p>Tips muchly appreciated</p>