title: Is there a `connect by` alternative in MySQL?
body: <p>If I use Oracle there is the <code>connect by</code> keyword which can be used to create hierarchical queries. Currently I'm using MySQL on a project and I would like to know whether there is an alternative for <code>connect by</code> in MySQL?</p>
  
  <p>I tried google but for no avail so far. What I'm trying to achieve is to fetch a tree from the database with one query. There are two tables involved:</p>
  
  <p><code>areas</code> and <code>area_to_parent_join</code>. The latter contains two ids one is <code>area_id</code> and the other is <code>parent_id</code>. So it is basically a self-join and I can create graphs using that model. In fact it is currently only used to create trees but this might change in the future. But in either case what I would like to have is just a spanning tree.</p>
  
  <p><strong>Edit:</strong> <code>areas</code> might have more than 1.000.000 records which makes most of the space-intensive options unfeasible.</p>