title: Remove duplicates per row MySQL
body: <p>I have a table that looks like this</p>
  
  <pre><code>| Domain | Owner   | Nameservers         |
  __________________________________________
  | Test1  | Person1 | Serv1, Serv2, Serv3 |
  | Test2  | Person2 | Serv1               |
  | Test3  | Person3 | Serv1, Serv2        |
  </code></pre>
  
  <p>My plan is to split the nameservers into own colums. (I need this structure for further import to a third party system)..</p>
  
  <pre><code>| Domain | Owner   | Nameserver1 | Nameserver2 | Namerserver3 |
  _______________________________________________________________
  | Test1  | Person1 | Serv1       | Serv2       | Serv 3       |
  | Test2  | Person2 | Serv1       |             |              |
  | Test3  | Person3 | Serv1       | Serv2       |              |
  </code></pre>
  
  <p>The empty spaces in the table could be an empty string or NULL.</p>
  
  <p>I've tried the following query:</p>
  
  <pre><code>CREATE TABLE temp_import_table AS
    SELECT domain, 
           owner, 
           SUBSTRING_INDEX( `nameservers` , ',', 1 ) AS nameserver1,
           SUBSTRING_INDEX(SUBSTRING_INDEX( `nameservers` , ',', 2 ),',',-1) AS nameserver2, 
           SUBSTRING_INDEX( `nameservers` , ',', -1 ) AS nameserver3
  </code></pre>
  
  <p>But somehow i get the following result: </p>
  
  <pre><code>| Domain | Owner   | Nameserver1 | Nameserver2 | Namerserver3 |
  _______________________________________________________________
  | Test1  | Person1 | Serv1       | Serv2       | Serv3        |
  | Test2  | Person2 | Serv1       | Serv1       | Serv1        |
  | Test3  | Person3 | Serv1       | Serv2       | Serv2        |
  </code></pre>
  
  <p>As you can see the nameservers is being populated with the "previous" nameserver even if it's empty in the csv field. Can anyone help me get rid of/empty the duplicate values per row?</p>