title: Combine two SELECT queries in PostgreSQL
body: <p>I would like to combine two select queries with <code>UNION</code>.<br>
  How can I use the result from the first <code>SELECT</code> in the second <code>SELECT</code>?</p>
  
  <pre><code>(SELECT carto_id_key FROM table1
      WHERE tag_id = 16)
  UNION 
  (SELECT * FROM table2
      WHERE carto_id_key = &lt;the carto_id result from above&gt; )
  </code></pre>