title: Update Statement using Derived Table
body: <p>I am trying to write the following update statement;</p>
  
  <pre><code>        UPDATE @eticat
          SET eticat_purchase_total = t.eticat_purchase_total
          FROM (
          SELECT eticat_id, COUNT(eticat_id) as eticat_purchase_count
              FROM etransaction
                  INNER JOIN etransaction_item 
                      INNER JOIN etransaction_item_catalog ON eti_eticat_id = eticat_id 
                  ON eti_et_id = et_id
          WHERE et_cmc_id = @can_cmc_id 
          GROUP by eticat_id
          ) as t
          WHERE eticat_id = t.eticat_id
  </code></pre>
  
  <p>But it keeps complaining about ambigous columns. Can someone please tell me what I am doing wrong.</p>
  
  <p>EDIT: Error Message is "Ambiguous column name 'eticat_id'."</p>
  
  <p>That line is 'WHERE eticat_id = t.eticat_id'</p>