title: How do I reference the table being updated in the "set" portion of my update statement?
body: <p>I'm using MySQL 5.5.37.  I want to update a table and I would like to use the value of the specific row I wish to update the in the query clause I use to get an update value.  So for instance, I alias my table like so</p>
  
  <pre><code>update session ts set
  </code></pre>
  
  <p>and so I would like to reference "ts.id" in the "set" portion of the statement, if that's possible.  I tried</p>
  
  <pre><code>update session ts set user_id = (select q.* from
    (select u.id FROM session t, training_session_org tso, organization o, user u
     where o.user_id = u.id and tso.organization_id = o.id
       and t.id = tso.training_session_id and t.id = ts.id) q);
  </code></pre>
  
  <p>But I'm getting a </p>
  
  <pre><code>ERROR 1054 (42S22): Unknown column 'ts.id' in 'where clause'
  </code></pre>
  
  <p>What's the proper way to reference my updated table in the query, if its possible?  Also, I want to do this in one SQL statement, not multiple ones.</p>