title: Looping on a Select query result set element and get the elements in MySQL
body: <p>I am using <code>MySQL 5.2.42 CE</code>.</p>
  
  <p>I have a table which has a column named <code>"organization_id"</code>. It contains some repeated values for different rows, means more than one row can have <code>"org1"</code> value in that field.
  Now I have to loop through the distinct values of that column, means different organizations.</p>
  
  <p>But I don't know if there is any <code>For-Each loop in mysql</code>.</p>
  
  <p>I have done like this:</p>
  
  <pre><code>Select Distinct organization_id From tbl_organization
  </code></pre>
  
  <p>this is returning me all the different organizations. Now how can I loop through the list and access each organization_id? I am writing this in a trigger in DB.
  Please help.</p>
  
  <p>Thanks &amp; Regards,
  Surodip Patra</p>