title: MySQL - Query Tree of Data?
body: <p>I have a data set like this in a MySQL database, but it's about 50,000+ records.</p>
  
  <pre><code>A01                   Description
  A01.01                Description
  A01.02                Description
  A01.03                Description
  A01.03.01             Description
  A01.03.02             Description
  A01.03.02.01          Description
  A01.03.03             Description
  A02                   ....
  A02.01
  A03
  B01
  B02
  B02.02
  B02.03
  ...
  </code></pre>
  
  <p>I'd like to do a query where I can pass something like "A" that gets me all the children of but just one level deep, so I get A01, A02, A03, but I also need to know that A01 and A02 have children and A03 does not.</p>
  
  <p>I'll need to repeat the query passing "A01.03" to get A01.03's children and know that A01.03.02 has children but the others do not.</p>
  
  <p>I've got a database of about 50,000+ of these and need to efficiently query it on demand.  I can probably change the structure a bit or add flags if needed.</p>
  
  <p>Any tips or ideas would be greatly appreciated! Thanks!</p>