title: SQL Server: Find duplicate substrings in one column
body: <p>I have a table of clients in SQL Server. I'm trying to find away to find duplicates in the email_address column, but I need to only consider part of the column data, so a substring. In practical terms I need to find duplicate domain names in the records.</p>
  
  <p>I have used the following query to find exact duplicates (on the whole field), but how can I modify this to consider a substring?</p>
  
  <pre><code>SELECT a.email_address, b.dupeCount, a.client_id
  FROM tblClient a
  INNER JOIN (
      SELECT email_address, COUNT(*) AS dupeCount
      FROM tblClient
      GROUP BY email_address
      HAVING COUNT(*) &gt; 1
  ) b ON a.email_address = b.email_address
  </code></pre>
  
  <p>Many thanks!</p>