title: How to storing Sub query in variable. MySql
body: <pre><code>SET @variable1 = (SELECT id FROM table2);
  update vars set unq=1 where id IN @variable1
  </code></pre>
  
  <p>how to perform the above query. because there are one million rows and sub query taking too much time for update. so how to save all ids of table2 in var and use in second query.</p>