I have multiple tables (tbldept, tblcourse, tblstud, tblviolation) and I want to extract specific values. The below tables is like the same on my tables
tbldept
id | dept
1 | deptA
2 | deptB
tbldept has foreign key on tblcourse
tblcourse
id | deptId | course
1 | 2 | courseA
2 | 1 | courseB
3 | 1 | courseC
tblcourse has foreign key on tblstud
tblstud
id | courseId | name
1 | 1 | studA
2 | 2 | studB
3 | 1 | studC
tblstud has foreign key on tblviolation
tblviolation
id | studId | violationName
1 | 3 | violationA
2 | 2 | violationB
3 | 1 | violationC
4 | 3 | violationC
*What I want to get is look like this: *
dept | studId | name | violationName
2 | 1 | studA | violationC
2 | 2 | studB | violationB
1 | 3 | studC | violationA
1 | 3 | studC | violationC
I want to get all the rows of tblviolation for each studId.
I hope you guys understand what I am trying to explain. =) Thank you.