title: Display multiple row data within 1 row MySQL PHP
body: <p>I have the following query which pulls from 3 tables. I'll end up with 1 family per row but with multiple children for each. I want to be able to show all children ages within the family row. I thought about opening another connection/query, but figured there is a smarter way.</p>
  
  <p>Query:</p>
  
  <pre><code>SELECT 
      families.*, job.*, children.*, families.first_name AS fam_firstname, children.first_name AS child_firstname
  FROM job
      LEFT OUTER JOIN families ON job.fam_id = families.fam_id
      LEFT OUTER JOIN children ON families.fam_id = children.fam_id
  WHERE 
      job.published = 2 
  GROUP BY job.job_id
  ORDER BY job.created_on DESC
  </code></pre>
  
  <p>Loop:</p>
  
  <pre><code>if ($result = $mysqli-&gt;query($query)) {
  
      $from = new DateTime($row['dob']);
      $to   = new DateTime('today');
  
      while ($row = $result-&gt;fetch_assoc()) {
           echo '&lt;tr&gt;';
           echo '&lt;td&gt;' .$row['fam_firstname']. '&lt;/td&gt;';
           echo '&lt;td&gt;' .$row['last_name'].'&lt;/td&gt;';
  
           /* Looking to list all children ages. Separate by comma or break  */
           echo '&lt;td&gt;' . $from-&gt;diff($to)-&gt;y .'&lt;/td&gt;';
  
           echo '&lt;/tr&gt;';
      }
  
      $result-&gt;free();
  }
  </code></pre>
  
  <p>Desired Output: </p>
  
  <pre><code>Family First Name  |   Family Last Name   |   Child 1 Age, Child 2 Age
  </code></pre>