title: update multi table simultaneously in MySQL
body: <p>I have a queries like these below and I need it to be in a single update query. As I'm a beginner I use joins and wrote the single line query but I get error as </p>
  
  <blockquote>
    <p>Lock wait timeout exceeded; try restarting transaction</p>
  </blockquote>
  
  <p>Here below is the each Individual update query...</p>
  
  <pre><code>update a set id=id-1 where id&gt;'3' and reg='34554';
  update b set id=id-1 where id&gt;'3' and reg='34554';
  update c set id=id-1 where id&gt;'3' and reg='34554';
  update d set id=id-1 where id&gt;'3' and reg='34554';
  update e set id=id-1 where id&gt;'3' and reg='34554';
  </code></pre>
  
  <p>Here below is what I tried out and got error as told above...</p>
  
  <pre><code>update a
  LEFT JOIN b ON b.id=a.id and b.tan=a.tan
  LEFT JOIN c ON c.id=b.id and c.tan=b.tan
  LEFT JOIN d ON d.id=c.id and d.tan=c.tan
  LEFT JOIN e ON e.id=d.id and e.tan=d.tan
  SET a.id=b.id=c.id=d.id=e.id=a.id-1
  where a.id&gt;'3' and a.tan='34554';
  </code></pre>