title: Redshift - ERROR: Target table must be part of an equijoin predicate
body: <p>I am trying to make an update on a temporal table I created in Redshift. The code I am trying to run goes like this:</p>
  <pre><code>UPDATE #new_emp
  SET rpt_to_emp_id = CAST(ht.se_value AS INTEGER),
      rpt_to_extrnl_email = ht.extrnl_email_addr,
      rpt_to_fst_nm = ht.first_nm,
      rpt_to_lst_nm = ht.last_nm,
      rpt_to_mdl_init = ht.mdl_nm,
      rpt_to_nm = ht.full_nm,
      rpt_to_ssn = CAST(ht.ssn AS INTEGER),
  FROM #new_emp,
       (SELECT DISTINCT t.se_value,h.first_nm,h.last_nm,
          h.mdl_nm,h.full_nm,h.ssn,h.extrnl_email_addr
          FROM spec_hr.dtbl_translate_codes_dw t, spec_hr.emp_hron h
          WHERE t.inf_name = 'system'
          AND t.fld_name = 'HRONDirector'
          AND h.foreign_emp_id = t.se_value
      ) ht
  WHERE  #new_emp.foreign_emp_id &lt;&gt; ht.se_value
      AND (#new_emp.emp_status_cd &lt;&gt; 'T'
      AND (#new_emp.ult_rpt_emp_id = #new_emp.foreign_emp_id
      OR #new_emp.ult_rpt_emp_id = #new_emp.psoft_id
      OR #new_emp.ult_rpt_emp_id IS NULL)); 
  </code></pre>
  <p>I've tried both with and without specyfing the updated table from the FROM command. But it keeps throwing me this error:</p>
  <p><code> ERROR: Target table must be part of an equijoin predicate</code></p>
  <p>Any ideas why is this failing? Thank you!</p>