title: mysql select columns in join query
body: <p><strong>Scenario:</strong> </p>
  
  <p>Students can register in one or more classes.</p>
  
  <p><strong>Structure:</strong> </p>
  
  <p><strong>students</strong> table has columns: <strong>id,firstname, lastname, email, dob, age, gender, mobile, address</strong>.</p>
  
  <p><strong>classes</strong> table has columns: <strong>id,name</strong>.</p>
  
  <p><strong>student_classes</strong> table has columns: <strong>student_id,class_id</strong> </p>
  
  <p>Now Iam joining 3 tables: students, classes, student_classes with an inner join query:</p>
  
  <pre><code>select *
  from students inner join student_classes 
    on students.id=student_classes.student_id  inner join classes
    on student_classes.class_id=classes.id
  </code></pre>
  
  <p>But i don't want all the columns from the students table. I just want the firstname.
  How can i modify the join query?</p>