I have three tables like this:
Student
stuNum | stuName
------------------
2012 | jack
2013 | tom
Quiz
quizNum | quizName
------------------
1 | chapter 1
2 | chapter 2
3 | chapter 3
studentassessment
stuNum | quizNum | assessmentMark
-----------------------------------
2012 | 1 | 10
2012 | 2 | 8
2012 | 3 | 10
2013 | 1 | 5
I want to get result something like this
stuNum | stuName | Quiz Num | assessmentMark
--------------------------------------------
2012 | jack | 1 | 10
2012 | jack | 2 | 8
2012 | jack | 3 | 10
description : all three table are connected.. i want to get the stuNum=2012, quizNum that all stuNum have done.
I tried several combination to fetch result but can't work. this is example combination that i tried :
$sql = "select a.stuNum,a.quizNum,a.assessmentMark from studentassessment a inner join student b on a.stuNum=b.stuNum inner join quiz c on a.quizNum=c.quizNum where b.stuNum='2012'"