title: Store query result in variables to use in another query in Postgresql
body: <p>I am new to Postgresql. Please help me to solve it.</p>
  
  <p>Suppose I have three table called 'table_1', 'table_2' &amp; 'table_3'</p>
  
  <p>I want to get data from table_3 that is related to table_1 and table_2</p>
  
  <p>Such as I am retrieving value_1 and value_2 from table_1 and table_2</p>
  
  <p>Query 1:</p>
  
  <pre><code>Select value_1 From table_1
  </code></pre>
  
  <p>Query 2:</p>
  
  <pre><code>Select value_2 From table_2
  </code></pre>
  
  <p>Now I want to use these values in table_3</p>
  
  <p>Query 3:</p>
  
  <pre><code>Select * from table_3 where column_1 = value_1 and column_2 = value_2
  </code></pre>
  
  <p>How to store first 2 values in variables and use it in third query?</p>