title: Joining 6 tables without duplicates
body: <p>I've tried to get data from 6 different tables with joins, but every time there are showing multi duplicates. I a read a lot about that, but after many experiments I did not come to answer. Hope someone will know the answer. Here are my tables and one of my experiments.</p>
  
  <ol>
  <li>Users -id, email </li>
  <li>Teachers - id, user_id, name, telephone</li>
  <li>Teacher_class - id, class_id, teacher_id </li>
  <li>Classes - id, class</li>
  <li>Teacher_Disipline - id, discipline_id, teacher_id </li>
  <li>Disciplines - id,
  discipline</li>
  </ol>
  
  <p>I am trying to get this view:</p>
  
  <pre><code>Name                 Email               Telephone         Classes     Disciplines
  ---------------------------------------------------------------------------------
    First name       first@gmail.com      2559857544         Va,VB,VIa   Html,CSS
  </code></pre>
  
  <p>Instead my table looks like this:</p>
  
  <pre><code>Name                 Email               Telephone         Classes     Disciplines
  ---------------------------------------------------------------------------------
    First name       first@gmail.com      2559857544           Va          Html
    First name       first@gmail.com      2559857544           Vb          Html
    First name       first@gmail.com      2559857544           VIa         Html
    First name       first@gmail.com      2559857544           Va          CSS
    First name       first@gmail.com      2559857544           Vb          CSS
    First name       first@gmail.com      2559857544           VIa         CSS
  </code></pre>
  
  <p>Here is my code</p>
  
  <pre><code>$sql_users_students = "SELECT * FROM users 
  INNER JOIN teachers ON users.id = teachers.user_id
  INNER JOIN teacher_class ON teachers.user_id = teacher_class.teacher_id
  INNER JOIN classes ON teacher_class.class_id = classes.id
  LEFT JOIN teacher_discipline ON teachers.user_id = teacher_discipline.teacher_id
  left JOIN disciplines ON teacher_discipline.discipline_id = disciplines.id";
  
   &lt;tbody&gt;
   &lt;?php foreach($teachers as $key =&gt; $info){
    echo "&lt;tr&gt;&lt;td&gt;".$info["name"]."&lt;/td&gt;&lt;td&gt;".$info["email"]."&lt;/td&gt;&lt;td&gt;".$info["telephone"]."&lt;/td&gt;&lt;td&gt;".$info["class"]."&lt;/td&gt;&lt;td&gt;".$info["discipline"]."&lt;/td&gt;&lt;/td&gt;&lt;td&gt;&lt;a href=''php/delete_student.php''&gt;Изтриване&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;";} ?&gt;                 
    &lt;/tr&gt;
   &lt;/tbody&gt;
  </code></pre>