title: update sql table with multi-jojn
body: <p>I have the SQL statement below which pulls data from multiple tables, as can be seen that the chapter Id is null in the tblquestions i would like to know how i would update the table so that it shows the chapter id which is being pulled from  with a matching section id in the question table </p>
  
  <p>in turn I want to update the tblQuestions, with the chapterId where the section Id equals that of the section chapterid</p>
  
  <pre><code>select chap.chapterID , sec.sectionID, q.ChapterId , q.sectionID from tblChapters as chap
  left join tblSections as sec on chap.chapterID = sec.chapterID
  left join tblQuestions as q on chap.subjectID = q.subjectID
  where chap.subjectID  = 363
  group by chap.chapterID, sec.sectionID, q.ChapterId , q.sectionID 
  </code></pre>
  
  <p>OutPut</p>
  
  <pre><code>chapterID   sectionID   ChapterId   sectionID
  22266       4869        NULL         4869
  </code></pre>
  
  <p>Tbl chapter</p>
  
  <pre><code>chapterID
  subjectID
  chapterNo
  Title
  cssID
  OldChapterId
  </code></pre>
  
  <p>tbl sections</p>
  
  <pre><code>sectionID
  chapterID
  sectionNO
  Title
  cssID
  oldSecId
  </code></pre>
  
  <p>tblQuestions</p>
  
  <pre><code> questionID
  QuestionType
  QuestionNo
  question
  A
  B
  C
  D
  correctAnswer
  explanation
  bookRef
  sectionID
  subjectID
  syllabusRef
  noChapSec
  ChapterId
  oldChapIf
  OldSubID
  oldSecId
  </code></pre>