title: Fetch data from multiple tables in postgresql
body: <p>I am working on an application where I want to fetch the records from multiple tables which are connected through foreign key. The query I am using is </p>
  
  <pre><code>  select ue.institute, ue.marks, uf.relation, uf.name
    from user_education ue, user_family uf where ue.user_id=12 and uf.user_id=12
  </code></pre>
  
  <p>The result of the query is</p>
  
  <p><img src="https://i.stack.imgur.com/Nsjdf.png" alt="Result"></p>
  
  <p>You can see the data is repeating in it. I only want a record one time. I want no repetition. I want something like this</p>
  
  <pre><code>T1                 T2
  
  id|name|fid      id|descrip| fid
  1 |A   |1         1|DA     | 1
  2 |B   |1         2|DB     | 1
  2 |B   |1         
  </code></pre>
  
  <p>Result which I want:</p>
  
  <pre><code>Result:
  
  id|name|fid|id|descrip| fid
  1 |A   |1  |1|DA     | 1
  2 |B   |1  |2|DB     | 1
  2 |B   |1  |       
  </code></pre>
  
  <p>The results fetched through your query</p>
  
  <p><img src="https://i.stack.imgur.com/llstz.png" alt="enter image description here"></p>
  
  <p>The total rows are 5</p>
  
  <p>More Information</p>
  
  <p><img src="https://i.stack.imgur.com/hXWhg.png" alt="Table 1"></p>
  
  <p><img src="https://i.stack.imgur.com/ho9Kf.png" alt="Table 2"></p>
  
  <p>I want the rows of same <code>user_id</code> from both tables but you can see in T1 there are 3 rows and in T2 there are 2 rows. I do not want repetitions but also I want to fetch all the data on the basis of <code>user_id</code> </p>
  
  <p>Table Schemas,s</p>
  
  <p><a href="https://i.stack.imgur.com/JT4RE.png" rel="nofollow noreferrer">T1</a>
  <a href="https://i.stack.imgur.com/MOKIr.png" rel="nofollow noreferrer">T2</a></p>