title: How to join multiple temp tables (using with clause) in Oracle SQL
body: <p>I've created multiple temp tables which I want to link together into one result set.</p>
  
  <p>I've only been able to get the individual temp tables created using with clause, but don't know how to join them together. There are primary key field is file_id to join all three tables together. </p>
  
  <pre><code> WITH file_data AS ( 
    SELECT fd.file_id, fd.receivedate, fd.datestart, fd.dateend
    FROM trans_detail td join file_detail fd
    on fd.receivedate between '1 Jun 2019' and '30 Jun 2019'
   ) 
  
  WITH tran_data AS ( 
  SELECT fd.file_id, sum(td.tran_amt) as total_amt, sum(points) as 
  tran_points
  FROM trans_detail td join file_detail fd
  on td.date between fd.datestart and fd.dateend
  group by fd.file_id
  ) 
  
  
  WITH adj_data AS ( 
  SELECT fd.file_id, sum(ad.points) as adj_points
  FROM adj_detail ad join file_detail fd
  on adj.date between fd.datestart and fd.dateend
  group by fd.file_id
  ) 
  </code></pre>
  
  <p>expected result would be</p>
  
  <pre class="lang-none prettyprint-override"><code>file id    receivedate   datestart              datesend              total_amt     tran_points      adj_points
  123        1 Jun 2019    31/05/2019 9:51:50 PM  1/06/2019 9:51:50 PM
  </code></pre>