title: Is it possible to make query result in running another query?
body: <p>I have this query:</p>
  
  <pre><code>$aircraft_query = "SELECT COUNT(aircraft) as total, aircraft FROM db_pireps WHERE pilotid = $pilotid GROUP BY aircraft ORDER BY total DESC LIMIT 6";
  $planes = DB::get_results($aircraft_query);
  </code></pre>
  
  <p>And using a foreach statement, I can generate rows in a table to show aircrafts flown by a <code>pilotid</code>. However, I'd like now the <code>RESULT</code> to link to another table and extract data from there, such as aircraft type, in a <code>fullname</code> column.</p>
  
  <p>I have this: <code>&lt;?php echo $aircraft-&gt;fullname; ?&gt;</code> but that data is in a different table. So, if <code>aircraft</code> was 30, it would access 30th record in <code>db_aircrafts</code> table and take the <code>fullname</code> column. How can I do this? Is it even possible?</p>