title: MySQL Parent details if it is a child account
body: <p>I have a table with data like the following</p>
  
  <pre><code>id    name      created         parent
  ------------------------------------------------
  1     Alpha     11385209583     0
  2     Bravo     11385209619     0
  3     Bravo-A   11385209701     2
  4     Bravo-B   11385209777     2
  </code></pre>
  
  <p>such that Bravo-A and Bravo-B are children of Bravo.</p>
  
  <p>There is another table with email addresses in it (accounts a JOIN emails e ON a.id = e.account_id), but only parent accounts have emails. That is to say, Bravo-A's email is Bravo's.</p>
  
  <p>If I have the accounts.id number, is it possible to write a query that would give me the emails.email field for the correct account (where account_id = 1 when id is 1, account_id = 2 when id is 2, 3, or 4)?</p>
  
  <p>(My apologies if this is a little verbose or not to the point, I was having trouble verbalizing it!)</p>