I have three tables tblCourse
, tblDegree
, tblStudent
. I have created a course and degree relation table as like tblCourseDegreeRelation
. This relational table uses foreign keys of course and degree table as like:
The tblCourseDegreeRelation
table is like:
The tblCourse
table is like:
The tblDegree
table is like:
The tblStudent
(In this table the degree id is foreign key d_id
) table is like:
I need to get all records including the tblStudent
all record using this query:
SELECT * from tbldegree d
INNER JOIN tblcoursedegreerelation cdr ON d.d_id = cdr.d_id
INNER JOIN tblcourse c ON cdr.c_id = c.c_id
INNER JOIN tblstudent s ON d.d_id = s.d_id
ORDER BY cdr.cdr_id DESC
But this only returns the one student's record while I've two students in the database see below:
How I can get all students records from the joins query?