title: Getting SQL Error: ORA-00957: duplicate column name, while creating view
body: <p>I am trying to make a view, but I am getting a duplicate column name error. If I run the select query separately, then the query returns a result like:</p>
  
  <pre><code>SELECT distinct app.APP_REF_NO, app.APP_STATUS, app.APP_DT, app.ATTEND_STAFF,
                  app.ATTEND_BRANCH, app.PRODUCT_TYPE, cust.CUST_ID, 
                  cust.APP_JOINT_T, cust.ID1_TYPE, cust.ID1, cust.ID2_TYPE, 
                  cust.ID2, cust.FIRST_NAME, cust.LAST_NAME, cust.FULL_NAME, 
                  cust.FULL_NAME_CAP, cust.DOB, fac.FACILITY_NO, fac.PRODUCT_TYPE,
                  fac.PRODUCT_CODE, fac.MAIN_PROD_IND, fac.AMT_APPLIED
  FROM 
      LOSA_APP app 
  LEFT JOIN 
      LOSA_CUST cust 
  ON
      cust.APP_REF_NO = app.APP_REF_NO
  LEFT JOIN 
     LOSA_FACILITIES fac 
  ON
      fac.APP_REF_NO = app.APP_REF_NO
  LEFT JOIN 
      OS_CURRENTSTEP STEP 
  ON
      STEP.REF_ID = app.APP_REF_NO
     WHERE (app.APP_STATUS ='P' OR app.APP_STATUS ='T' OR 
           ((app.APP_STATUS='R' OR app.APP_STATUS='S') AND STEP.STEP_NAME='011'));
  </code></pre>
  
  <p>This query works fine. But when I try to run it as a view like:</p>
  
  <pre><code>CREATE VIEW basit_test1 AS
  SELECT distinct app.APP_REF_NO, app.APP_STATUS, app.APP_DT, app.ATTEND_STAFF,
                  app.ATTEND_BRANCH, app.PRODUCT_TYPE, cust.CUST_ID, 
                  cust.APP_JOINT_T, cust.ID1_TYPE, cust.ID1, cust.ID2_TYPE, 
                  cust.ID2, cust.FIRST_NAME, cust.LAST_NAME, cust.FULL_NAME, 
                  cust.FULL_NAME_CAP, cust.DOB, fac.FACILITY_NO, fac.PRODUCT_TYPE,
                  fac.PRODUCT_CODE, fac.MAIN_PROD_IND, fac.AMT_APPLIED
  FROM 
      LOSA_APP app 
  LEFT JOIN 
      LOSA_CUST cust 
  ON
      cust.APP_REF_NO = app.APP_REF_NO
  LEFT JOIN 
     LOSA_FACILITIES fac 
  ON
      fac.APP_REF_NO = app.APP_REF_NO
  LEFT JOIN 
      OS_CURRENTSTEP STEP 
  ON
      STEP.REF_ID = app.APP_REF_NO
     WHERE (app.APP_STATUS ='P' OR app.APP_STATUS ='T' OR 
           ((app.APP_STATUS='R' OR app.APP_STATUS='S') AND STEP.STEP_NAME='011'));
  </code></pre>
  
  <p>Then I get the duplicate column name error. Why am I getting this error?</p>