title: Postgres SELECT with multiple select as
body: <p>I'm trying to use the output from two SELECT statements in a PostGIS function.</p>
  
  <p>What is the correct syntax for doing this? I'm getting a syntax error at or near the second SELECT statement.</p>
  
  <pre><code>SELECT ST_Split(tracks, roads)
  FROM
  (
      SELECT * FROM (SELECT ST_Buffer(road_geom,50) FROM table1 WHERE a = '' AND b = '') as roads,
      SELECT * FROM (SELECT the_geom FROM table2 WHERE c = '' AND d = '') as tracks
  
  )
  </code></pre>
  
  <p>Error output:</p>
  
  <pre><code> ERROR:  syntax error at or near "SELECT"
   LINE 5:  SELECT * FROM (SELECT the_geom FROM table2...
       ^
  ********** Error **********
  ERROR: syntax error at or near "SELECT"
  SQL state: 42601
  Character: 178
  </code></pre>
  
  <p>Thanks!</p>