title: Uisng exists in sql to find duplicates, is there a cleaner way?
body: <p>See script below to find duplicates in SQL Server DB. Is there a cleaner way?</p>
  
  <pre><code>select itemnum 
  from matusetrans a
  where exists (select null 
                from matusetrans b 
                where a.itemnum = b.itemnum 
                  and a.actualdate = b.actualdate 
                  and a.matusetransid != b.matusetransid 
                  and (a.rotassetnum = b.rotassetnum 
                       or (a.rotassetnum is null and b.rotassetnum is null))    
                  and a.quantity = b.quantity)
  group by itemnum
  </code></pre>