title: SQL Server 2008 Update Query with Join and Where clause in joined table
body: <p>Not sure why this is not working:</p>
  
  <pre><code>UPDATE 
      ust
  SET  
      ust.isUnsubscribedFromSystemEmails = 1
  FROM         
      UserSetting AS ust 
  INNER JOIN
      [User] ON ust.userID = [User].userID 
  AND 
      [User].emailAddress IN (SELECT emailAddress FROM BadEmailAddresses)
  </code></pre>
  
  <p>In plain English, I am trying to set the <code>isUnsubscribed</code> field to unsubscribed where the <code>userID</code> in the <code>UserSetting</code> table equals the <code>userID</code> in the user table and where the <code>emailAddress</code> in the user table is not in a list of emails from another table. I can run a select on the isUnsubbed column using pretty much the same syntax and it works fine? thanks! </p>
  
  <p><strong>P.S.</strong> I've looked at other similar questions here and the syntax appears the same but obviously I'm missing something.</p>