title: mysql compare two tables to find matched records
body: <p>I'm trying to get all data from <code>tbl_attn_temp</code> which <code>TraineeID</code> are match with <code>tbl_assigned</code> <code>TraineeID</code> or <code>tbl_instructor_info</code> <code>InstructorID</code>. But I get all the data match with <code>tbl_assigned</code> <code>TraineeID</code>. <code>tbl_instructor_info</code> data not or showing with this query as below:</p>
  
  <p>tbl_attn_temp</p>
  
  <p><a href="https://i.stack.imgur.com/uZU6X.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uZU6X.png" alt="enter image description here"></a></p>
  
  <p>tbl_assigned</p>
  
  <p><a href="https://i.stack.imgur.com/YKOF8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YKOF8.png" alt="enter image description here"></a></p>
  
  <p>tbl_instructor_info</p>
  
  <p><a href="https://i.stack.imgur.com/bDx4y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bDx4y.png" alt="enter image description here"></a></p>
  
  <pre><code>SELECT t1.*
  FROM tbl_attn_temp t1, tbl_instructor_info t2, tbl_assigned t3
  WHERE t1.TraineeID=t3.TraineeID or t2.InstructorID
  GROUP by t1.traineeid, t1.attnDate
  </code></pre>