title: Fetch data from two tables based on a column from particular table
body: <p><a href="https://i.stack.imgur.com/FvGkq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FvGkq.png" alt="enter image description here"></a>i have two tables as :</p>
  
  <p>Table t1:  </p>
  
  <pre><code>+-----+----+  
  | i1  | c1 |  
  +-----+----+  
  | 11  | abc |  
  | 22  | bbc |  
  | 33  | cbc |  
  +-----+-----+  
  </code></pre>
  
  <p>Table t2:  </p>
  
  <pre><code>+-----+----+  
  | i2  | c2 |  
  +-----+----+  
  | 22  | cc |  
  | 33  | bb |  
  | 33  | bb |  
  | 44  | aa |
  | 22  | cc |  
  +-----+----+  
  </code></pre>
  
  <p>and output should be as </p>
  
  <pre><code>+----+-----+----+  
  | i1 | c1  | c2 |
  +----+-----+----+   
  | 22 | bbc | cc |
  | 33 | cbc | bb |
  +----+-----+----+
  </code></pre>
  
  <p>i tried joins but couldn't get the exact output</p>
  
  <p>fetch table1.user_id,table1affiliate_id where table1.affiliate_id=table2.id 
  should give reslut only from table one eg:table1  has 26 rows, and table2 has 125 rows ,where table2 has all  26 rows of table1 and more , so i need the output to print only 26 related fields from two tables...</p>