title: SQL Server client codes and client names discrepancy based on the 1st number of the client code linked to different clients
body: <p>I've got a table with client codes and client names. The client codes used before were e.g.<strong>M</strong>1003993. They were updated, and now client codes are created starting with <strong>7</strong>1003993. The client names linked to these client codes (both M, 7) are different clients names, so I cannot filter discrepancy in client codes based on the same client name.</p>
  
  <p>What I need is how to get extracted 1 DISTINCT client code with linked to it client name (<strong>M</strong>1003993) and join it to the similar DISTINCT client code with its own DISTINCT client name (<strong>7</strong>1003993) meaning that I need a reference list of codes where 1st letter or number of the client code is different whilst the rest 7 numbers are the same? All this is done within 1 table.</p>
  
  <p>My guess is that the same table should be joined back to itself, but how to create this cross-reference when we have (<strong>7</strong>1003993) and (<strong>M</strong>1003993) codes with different client names.</p>
  
  <p>Image below shows SELECT, maybe it will help to explain what I mean</p>
  
  <p><a href="https://i.stack.imgur.com/JEQHJ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JEQHJ.jpg" alt="enter image description here"></a></p>
  
  <p>I need to identify client names for both codes M and 7, so 71003993 (client name 1 ) = M1003993 (client name 2), and this is for 260,000 records</p>