title: SQL Duplicate column names error in Create View, even with aliases
body: <p>The error is oddly specific, but I've just about honed in where it's occurring. The standard fix doesn't seem to be working though.</p>
  
  <p>Here's where the error occurs. It's a big statement, so I'm just posting where I've found the error</p>
  
  <pre><code> CREATE OR REPLACE VIEW SalesInvoiceDoc 
   AS 
   ( SELECT si.salinv_Num, si.salinv_Terms, si.salinv_SaleDate, 
            es.empName AS SalesAgent, man.empName AS ApprovingManager,
            si.salinv_ApproveDate, ...
  
   ... FROM service_invoice si
   JOIN employee es
      ON (es.empID = si.salinv_EmpID)
   JOIN employee man
      ON (man.empID = si.salinv_ManID)
  </code></pre>
  
  <p>Essentially it's a Sales invoice document with a sales agent and approving manager. Both are stored in the employee table with a subtype discriminator set up for 'manager' or 'sales', and views for the subtype children tables to avoid duplication errors.</p>
  
  <p>I've supplied aliases to try and avoid duplicate columns, but when I run this script, I get the duplicate column names error:</p>
  
  <pre><code>ORA-00957: duplicate column name
  </code></pre>
  
  <p>Does anyone know how to resolve this? Is it even possible? Any help would be greatly appreciated. Thank you in advance!</p>
  
  <p>Edit: here's the full statement</p>
  
  <pre><code> CREATE OR REPLACE VIEW SalesInvoiceDoc
   AS
   ( SELECT si.salinv_Num, si.salinv_Terms, si.salinv_SaleDate,
      es.empName AS SalesAgent,
      man.empName AS ApprovingManager, si.salinv_ApproveDate,
      sc.custName, sc.custHouse, sc.custCity, 
      sc.custState, sc.custZIP, sc.custPhone, sc.custEmail,
      sv.vehicle_VIN, sv.vehicle_year, sv.vehicle_make, 
          sv.vehicle_model, sv.vehicle_ext_color, sv.vehicle_trim,
          sv.vehicle_list_base_price, sv.vehicle_mileage, sv.vehicle_condition,
          sv.vehicle_description,
       ti.vehicle_make, ti.vehicle_year, ti.vehicle_model, ti.vehicle_VIN, 
          ti.tradein_allowance,
      sv.vehicle_list_base_price "SellingPrice", sv.shipping "Shipping",
          ti.tradein_allowance "TradeAllowance",
  (sv.vehicle_list_base_price + sv.shipping - ti.tradein_allowance) "Subtotal",
  (sv.vehicle_list_base_price + sv.shipping - ti.tradein_allowance)*.0825 "Taxes",
  (sv.vehicle_list_base_price + sv.shipping - ti.tradein_allowance)*1.0825 "TotalSellingPrice"
  
   FROM sales_invoice si
  JOIN employee es
      ON (es.empID = si.salinv_EmpID)
  JOIN employee man
      ON (man.empID = si.salinv_ManID)
  JOIN customer sc
      ON (sc.custID = si.salinv_CustID)
  JOIN vehicle sv
      ON (sv.vehicle_VIN = si.salinv_SalVIN)
  LEFT OUTER JOIN vehicle ti
      ON (ti.vehicle_VIN = si.salinv_tiVIN)
   );
  </code></pre>