title: Find duplicate records in a table using SQL Server
body: <p>I am validating a table which has a transaction level data of an eCommerce site and find the exact errors.</p>
  
  <p>I want your help to find duplicate records in a 50 column table on SQL Server.</p>
  
  <p>Suppose my data is:</p>
  
  <pre><code>OrderNo shoppername amountpayed city Item       
  1       Sam         10          A    Iphone
  1       Sam         10          A    Iphone---&gt;&gt;Duplication to be detected
  1       Sam         5           A    Ipod
  2       John        20          B    Macbook
  3       John        25          B    Macbookair
  4       Jack        5           A    Ipod
  </code></pre>
  
  <p>Suppose I use the below query:</p>
  
  <pre><code>Select shoppername,count(*) as cnt
  from dbo.sales
  having count(*) &gt; 1
  group by shoppername
  </code></pre>
  
  <p>will return me </p>
  
  <pre><code>Sam  2
  John 2
  </code></pre>
  
  <p>But I don't want to find duplicate just over 1 or 2 columns. I want to find the duplicate over all the columns together in my data. I want the result as:</p>
  
  <pre><code>1       Sam         10          A    Iphone
  </code></pre>