title: Remove second appearence of a substring from string in SQL Server
body: <p>I need to remove the second appearance of a substring from the main string, IF both substrings are next to each other. e.g.:</p>
  
  <p><code>Jhon\Jhon\Jane\Mary\Bob</code> needs to end <code>Jhon\Jane\Mary\Bob</code></p>
  
  <p>but <code>Mary\Jane\Mary\Bob</code> has to remain unchanged.</p>
  
  <p>Can anyone can come out with a performant way to do this?</p>
  
  <p>'\' is the separator of different names, so it can be use as limit of the substring to replace.</p>
  
  <p><strong>EDIT</strong>: this is to be run on a SELECT statement, so it should be a one line solution, I can't use variables.
  Also, if the names are repetaed anywhere else, I have to let them there. Only remove one occurrence if both the first and the second names are the same.</p>