title: SQL - JOIN and SUBQUERY
body: <p>I'm trying to make a join in 2 tables (stg.ac_esb and stg.ac_eeb), both have emp_codigo, so im using this column to set the relation. But,when i try to extract the data from the join's result, the error says: ERROR:  column reference &quot;emp_codigo&quot; is ambiguous. Can anyone help me with this plssss!</p>
  <pre><code>`SELECT
   **emp_codigo** as NUMEMP /* Código da Empresa SIM*/
   , epg_codigo as TIPCOL /* Tipo do Colaborador SIM*/
   , ' ' as NUMCAD /* Cadastro do Colaborador SIM*/
   , dtinicial as INIETB /* Data de Início da Estabilidade SIM */
   , dtfinal as FIMETB /* Data Final da Estabilidade  NÃO */
   , codigo as CODETB /* Código da Estabilidade SIM */
   FROM 
      (SELECT * 
          FROM stg.ac_esb
          JOIN stg.ac_eeb
          ON ac_esb.emp_codigo = ac_eeb.emp_codigo) AS Estabilidades;`
  </code></pre>