title: SQL- selecting between duplicate rows by comparing field values
body: <p>I was wondering if anyone can assist me.
  I already manage to insert only the rows that are not duplicated</p>
  
  <pre><code>NSERT INTO temp_Log  
  SELECT dq1.RowID,dq1.Action FROM DQLog dq1
      WHERE dq1.RowID 
      NOT IN (SELECT RowID FROM DQLog dq2
                  group by dq2.RowID
                  having count(*)&gt;1
  </code></pre>
  
  <p>how ever i still need to filter the duplicated ones...
  how can I select a row by a comparing the value between the duplicated rows in the same table? </p>
  
  <pre><code>RowID  Action 
   1     Reject
   1     Allow
   2     Allow
   2     Fix
  </code></pre>
  
  <p>In this case i will only need to insert the first (reject+allow= Reject) and last row (Allow+Fix = Fix).</p>
  
  <p>Thank you all for your time.</p>