title: sql server 2005 'update from' query
body: <p>I'm trying to update a table based upon the user id from another table.  I've come across the Update from syntax but I'm struggling to write my query correctly.</p>
  
  <p>The below code should show you what I'm attempting to do.  When i run it i get 0 rows affected.</p>
  
  <pre><code>    update jared_test
         set user_count  = 1
        from new_user nuj
  inner join (select us.userID
                from users us
               where us.email = 'j@j.co.uk') u on nuj.userid = u.userid
  </code></pre>
  
  <p>/<strong><em>*</em>**<em>*</em>**<em>*</em>*</strong><em>EDIT</em><strong><em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em></strong>\</p>
  
  <p>I discovered there was a problem with my Cursor loop that was preventing this from working, so this does actually work.  However I'd be interested if a where is better than a from in this instance for optimisations.</p>