title: Table is specified twice, both as a target for 'UPDATE' and as a separate source for data in mysql
body: <p>I have below query in mysql where I want to check if <strong>branch id</strong> and <strong>year</strong> of <strong>finance</strong> type from <strong><em>branch_master</em></strong> are equal with <strong>branch id</strong> and <strong>year</strong> of <strong><em>manager</em></strong> then update status in <strong><em>manager</em></strong> table against <strong>branch id</strong> in <strong><em>manager</em></strong>   </p>
  
  <pre><code>UPDATE manager as m1 
    SET m1.status = 'Y'
    WHERE m1.branch_id IN (
      SELECT m2.branch_id FROM manager as m2 
       WHERE (m2.branch_id,m2.year) IN (
          (
            SELECT DISTINCT branch_id,year 
              FROM `branch_master` 
             WHERE type = 'finance'
          )
       )
    )
  </code></pre>
  
  <p>but getting error </p>
  
  <blockquote>
    <p>Table 'm1' is specified twice, both as a target for 'UPDATE' and as a
    separate source for data</p>
  </blockquote>