MYSQL return results where there exist at least one from the other table -


Say I have data from these two tables:

Student table column: < Pre> ID | Name

Course table column:

  id | Code | Name   

And I want to use the student and course as Student.id. To obtain the following course as a course:

  Student Course ----------------- 1 | C1 | B1 | A2 F2 | B2 | A3 C3 | B3 | F   

How do I ask it, with only one course, and the students will return with their other courses:

  Student Course ----- ------------ 1 | C1 | B1 | A3 C3 | B3 | F   

? I have tried:

  Choose Student.id, Course Course Course Inner Student On Course. Study = Student. ID where course. Code = 'C'   

but only me

  student. Course ----------------- 1 | C3 | C    

  select s.id, c c course c INNER JOIN student C. on S. Where studied = s.id is present (from selection 1 to course c 1 where c. Studded = c 1. student and c 1. course = 'c')    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -