title: Error: ORA-00905: missing keyword when joining table to a select query
body: <p>I am trying to link a table to a select query and I get the Error: ORA-00905: missing keyword.   This is the oracle sql I have written.</p>
  
  <p>When I run things separately data pulls.   Its when I try to join them I get the error.  I tried adding in the Group BY and Order by per some help information I found on the Internet but still get the same error.</p>
  
  <pre><code>SELECT
  
  AS_MASTER_NF.CONTRACT_NO
  , AS_HISTORY_NF.AH_CONTRACT_NBR
  , AS_MASTER_NF.ID
  , AS_MASTER_NF.A_INVENT_DATE
  , AS_MASTER_NF.A_DISP_DATE
  
  FROM INFL_IDS.AS_MASTER_NF
  LEFT JOIN (SELECT
                 NVL(SUBSTR(ALTERNATE_ID, 0, INSTR(ALTERNATE_ID, '*')-1), ALTERNATE_ID) AS ASSET
                , AS_HISTORY_NF.AH_CONTRACT_NBR
                 FROM INFL_IDS.AS_HISTORY_NF
                 WHERE LENGTH (AH_CONTRACT_NBR)&gt; 3) AS ASHISTORY
             ON INFL_IDS.AS_MASTER_NF.ID = INFL_IDS.ASHISTORY.ASSET
  
  WHERE AS_MASTER_NF.A_INVENT_DATE IS NOT NULL
  
  GROUP BY
  AS_MASTER_NF.CONTRACT_NO
  , AS_HISTORY_NF.AH_CONTRACT_NBR
  , AS_MASTER_NF.ID
  , AS_MASTER_NF.A_INVENT_DATE
  , AS_MASTER_NF.A_DISP_DATE
  
  ORDER BY
  AS_MASTER_NF.CONTRACT_NO
  , AS_HISTORY_NF.AH_CONTRACT_NBR
  , AS_MASTER_NF.ID
  , AS_MASTER_NF.A_INVENT_DATE
  , AS_MASTER_NF.A_DISP_DATE
  
  FETCH FIRST 20 ROWS ONLY
  </code></pre>