title: Cross Join and Left Outer Join of Tables in Database
body: <p>I have three table in my database</p>
  
  <p><strong>Employee Table</strong></p>
  
  <ul>
  <li>EmployeeId <strong>(PK)</strong></li>
  <li>Last Name</li>
  </ul>
  
  <p><strong>Question Table</strong></p>
  
  <ul>
  <li>Qid <strong>(PK)</strong></li>
  <li>Question</li>
  </ul>
  
  <p><strong>Questionnaire</strong></p>
  
  <ul>
  <li>QuestionnaireId <strong>(PK)</strong></li>
  <li>QId <strong>(FK)</strong></li>
  <li>EmployeeId <strong>(FK)</strong></li>
  <li>Response</li>
  <li>Details</li>
  </ul>
  
  <p>This is the SQL Query that I write on my own, but it is producing an output that I do not need</p>
  
  <pre><code> Select q.qid,e.employeeId, q.Question, eq.response 
   from employee e 
   cross join Question q
   left outer join employeequestionnaire eq on q.Qid= eq.Qid
   where e.employeeId = 1
  </code></pre>
  
  <p><strong>This is the output</strong></p>
  
  <pre><code>             Qid   EmployeeId        Question       Response 
               "1"       "1"          "Question1"     "0"
               "1"       "1"          "Question1"     "1"
               "2"       "1"          "Question2"     "1"
               "2"       "1"          "Question2"     "0"
               "3"       "1"          "Question3"     "1"
               "4"       "1"          "Question4"     NULL
  </code></pre>
  
  <p>But I need this kind of Output</p>
  
  <pre><code>             Qid    EmployeeId       Question       Response  
               "1"       "1"          "Question1"     "0"
               "2"       "1"          "Question2"     "1"
               "3"       "1"          "Question3"     "1"
               "4"       "1"          "Question4"     NULL
  </code></pre>
  
  <p>I am a newbie in SQL, sorry for my sample query..</p>