title: Join results using group by clause
body: <p>How do i join the below 2 queries
  Query 1</p>
  <pre><code>select phn,count(*) from table 1 
  group by phn
  having count(*)&gt;20 
  </code></pre>
  <p>with the above result i need to join table 2 to get ids</p>
  <p>Query 2</p>
  <pre><code>select count(distinct id) from table 2 
  where (result_of_query1).phn=table 2.phn
  </code></pre>