title: Mysql help updating rows with same value
body: <p>I have a table named status_t:</p>
  
  <pre><code>**id** **page** **status** **locked**_by
    1      0        2          0
    1      1        2          0
    1      2        2          0
    2      0        0          0
    2      1        2          0
    2      2        2          0
  </code></pre>
  
  <p>primary key is ( id, page) .</p>
  
  <p>In the above example I would like to update all the 
  rows that <strong>all pages</strong> have status = 2.</p>
  
  <p><strong>i.e.</strong> the query should update all the rows with id = 1 to status 3. So the table will become</p>
  
  <pre><code>**id** **page** **status** **locked**_by
    1      0        3          1
    1      1        3          1
    1      2        3          1
    2      0        0          0
    2      1        2          0
    2      2        2          0
  </code></pre>
  
  <p>I have tried:</p>
  
  <pre><code>SELECT * FROM  status_t AS t
   WHERE id IN   
   (SELECT id FROM status WHERE status = 0) LIMIT 10
  </code></pre>
  
  <p>the above query fetches the rows to be updated but I cannot do that:</p>
  
  <pre><code>UPDATE status_t as S1 WHERE id IN 
  (SELECT id FROM status_t WHERE status = 2) 
  SET S1.status = 3, S1.locked_by = 1
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>THE ABOVE TABLE IS JUST AN EXAMPLE.</p>
  
  <p>I do not want to update WHERE id = 1 . I just want to update rows no matter the id 
  that have status = 2 for the same id.
  In the above example if the row with key (2, 2) had status = 2 then it should be updated. </p>