title: Sum Column in Joined Table and add as column SQL
body: <p>So say I have two tables in Oracle SQL (not actually data but for ease should highlight my question)</p>
  
  <p>Table1 that contains only Order_id and Order_quantity and Table2 that contains only Order_id and Order_price</p>
  
  <p>Then I join them as follows</p>
  
  <pre><code>Select T1.Order_id,
  T1.Order_quantity,
  T2.Order_price,
  T1.Order_quantity*T2.Order_price As "Order_amount",
  Sum(Order_amount) As "Total_Sales"
  from Table1 T1
  inner join Table2 T2
  on T1.Order_id = T2.Order_id
  </code></pre>
  
  <p>So essentially I want to have two extra columns, one as the product of columns from the two tables, and another as the sum of that column in my joined table(so every entry will be the same). However as you need to </p>
  
  <pre><code>SUM(variable_name) From Table_Name
  </code></pre>
  
  <p>Can I assign a variable name to my new table and then refer to that. I tried the following but I'm getting a SQL command not properly ended error</p>
  
  <pre><code>Select T1.Order_id,
      T1.Order_quantity,
      T2.Order_price,
      T1.Order_quantity*T2.Order_price As "Order_amount",
      Sum(Order_amount) from New_Table As "Total_Sales"
      from (Table1 T1
      inner join Table2 T2
      on T1.Order_id = T2.Order_id) As New_Table
  </code></pre>
  
  <p>Thanks for any assistance, apologies as I have a pretty naive understanding of SQL at present </p>