title: SQLITE, Create a temp table then select from it
body: <p>just wondering how i can create a temp table and then select from it further down the script.</p>
  
  <p>Example. </p>
  
  <pre><code>CREATE TEMPORARY TABLE TEMP_TABLE1 AS 
  Select 
  L.ID,
  SUM(L.cost)/2 as Costs,
  from Table1 L
  JOIN Table2 C on L.ID = C.ID
  Where C.name  = 'mike'
  Group by L.ID
  
  
  
  Select 
  Count(L.ID)
  from Table1 L
  JOIN TEMP_TABLE1 TT1 on L.ID = TT1.ID;
  Where L.ID not in (TT1) 
  And Sum(L.Cost) &gt; TT1.Costs
  </code></pre>
  
  <p>Ideally I want to have a temp table then use it later in the script to reference from.</p>
  
  <p>Any help would be great!</p>