title: looping through multiple records
body: <p>The following criteria does 75% of what I need. It returns employees with two or more records, one of whom is status 'R' (TBL A) and one of which is not status not in 'a','r' (TBL B).</p>
  
  <p>What is the best way to loop through TBL B if the number of records on this table for a given employee is unknown?</p>
  
  <pre><code>SELECT DISTINCT A.EMPLID, A.EMPL_RCD, B.EMPL_RCD
  FROM TBL A, TBL B
  WHERE A.EMPLID = B.EMPLID
    AND A.EMPL_RCD != B.EMPL_RCD
    AND A.STATUS != 'A'
    AND B.STATUS = 'R'
  </code></pre>