title: MYSQL Repeat without i=i+1
body: <p>I have the following in a stored procedure </p>
  
  <pre><code>DECLARE PUserId int;
  SET PUserId = 0;
  REPEAT
  Does some stuff with it
  SET  PUserId = PUserId + 1;
  UNTIL PUserId  &gt; 6 END REPEAT;
  </code></pre>
  
  <p>The problem is that my UserIDs are not sequential, example, we have 6 users at the moment and the UserIDs are 1,6,75,234,456.</p>
  
  <p>So if I use UNTIL PUserId  > 6 END REPEAT; it will only work for the first user, to include them all, I have to use UNTIL PUserId  > 456 END REPEAT; which seems pointless running 456 times when I only need to run 6 times.</p>
  
  <p>Is there a better way of doing this?</p>