title: SQL update many rows using select
body: <p>I have a table2 that has the primary key ID of table1. I want you to do an update on table1 depending on the last date of each row compatible with table2. Ex:</p>
  
  <pre><code> tabela 1           tabela2 
  
   ID DES  CAN ###### ID DATA-
   1  test 0   ###### 1  12/10/2017 
   2  test 0   ###### 1  12/09/2017  
   3  test 0   ###### 2  12/09/2017
   4  test 0   ###### 3  12/10/2017
  </code></pre>
  
  <p>I intend to update only the records of table1 where the IDs in table2 have the current date + 15 days. try this but it does not work.</p>
  
  <pre><code>UPDATE table 
  SET 
    Col1 = i.Col1, 
    Col2 = i.Col2 
  FROM (SELECT ID, Col1, Col2 FROM other_table) i
  WHERE i.ID = table.ID 
  </code></pre>