MySQL Joins | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson

MySQL Joins

I have a table called student which has StudentID 1-4 and student first name and lastname I have a StudenCourse table which has studentID 1-4 also fields with classes enrolled Now I have get Student First name that is also in Student Course table. My query is SELECT Student.StudentID.Student.StudentFirstName,Student_Course.StudentID FROM Student INNER JOIN Student_Course ON Student.StudentID = Student_Course.StudentID WHERE Student.StudentID = Student_Course.StudentID AND ? Could you please help!

4th Aug 2022, 3:32 AM
Knowledge Is Power
Knowledge Is Power - avatar
1 Answer
+ 1
What do you want to get with the request? You have a point instead of a comma in your select. You don't need the WHERE on the ids because you already indicate it in the ON of Inner join (or you remove ON and leave the WHERE,...). If you want other information in the query, indicate it in the select.
4th Aug 2022, 5:23 AM
Roland - avatar