title: create stored procedure for multiple update queries
body: <pre><code>select id as ids from challenges where expire_date &gt; today
  </code></pre>
  
  <p>I need loop her for multiply ids like (foreach in php) <br></p>
  
  <pre><code>foreach (ids) 
  
      update challenges set status = 'expired' where id = ids
  
      update user_challenge set challenge_status = 'Expired' where challenge_status = 'Pending' and challenge_id = ids 
      update user_challenge set challenge_status = 'Failed' where challenge_status = 'Accepted' and challenge_id = ids 
  
  end for each;
  </code></pre>
  
  <p>can anyone please create stored procedure or single query to perform this, Thanks</p>