title: How to join two query which first one is made up of two parts?
body: <p>I have two query like these:</p>
  
  <p><strong>Query1:</strong></p>
  
  <pre><code>SELECT id, title col2, content col3 FROM Posts1 WHERE title = :q
  
    UNION ALL
  
  SELECT id, subject col2, description col3 FROM Posts2 WHERE Match (subject) AGAINST (:q)
  </code></pre>
  
  <p>The name of result table is <code>Posts3</code>.</p>
  
  <p>Now I want to join <code>Posts3</code> with <code>Votes</code> table <code>ON Posts3.id = Votes.Posts_id</code>:</p>
  
  <p><strong>Query2:</strong></p>
  
  <pre><code>SELECT id, sum(vote) From Votes
  </code></pre>
  
  <hr>
  
  <p>Well, how can I joint two above queries?</p>
  
  <hr>
  
  <p><strong>Example:</strong></p>
  
  <pre><code>// Posts1                             // Posts2
  +----+-------+---------------+        +----+---------+------------------+
  | id | title |    content    |        | id | subject |    description   |
  +----+-------+---------------+        +----+---------+------------------+
  </code></pre>
  
  <p>Suppose this is the result (<code>UNION ALL</code>) both <code>Posts1</code> and <code>Posts2</code>:</p>
  
  <pre><code>// Posts3                     
  +----+-------+---------------+
  | id | col2  |    col3       |
  +----+-------+---------------+
  </code></pre>
  
  <p>Also I have a <code>Votes</code> table like this:</p>
  
  <pre><code>// Votes
  +----+------+
  | id | vote |
  +----+------+
  </code></pre>
  
  <hr>
  
  <p>Now, I want to know, how can I <code>Posts3 JOIN Votes</code> ?</p>