 <p>I think you want to get only records which have two or more invoices of same number. You should try this</p> <pre><code>select * from tab_name tn where (select count(*) From tab_name where invoice = tn.invoice) &gt; 1 </code></pre>