title: mysql distinct group_concat values
body: <p>I have a bunch of user accounts that I need to create associations with based on DOB postcode etc.</p>
  
  <p>I have the following query:</p>
  
  <pre><code>SELECT DISTINCT CONCAT_WS(' , ' ,a.user_id , GROUP_CONCAT( b.user_id SEPARATOR ' , ' ) )
  FROM tbl_users_details a,
  tbl_users_details b
  WHERE a.user_id != b.user_id
  AND a.date_of_birth = b.date_of_birth
  AND a.postcode = b.postcode
  AND LEVENSHTEIN_RATIO( a.last_name , b.last_name ) &gt; 60
  GROUP BY a.user_id
  </code></pre>
  
  <p>To demonstrate my requirements...</p>
  
  <p>If accounts 1 5 9 and 12 meet the criteria (ie these are the same people)</p>
  
  <p>I will get 4 results in the format</p>
  
  <pre><code>1  , 5 , 9 , 12
  5  , 1 , 9 , 12
  9  , 1 , 5 , 12
  12 , 1 , 5 , 9
  </code></pre>
  
  <p>I deally I'd like just 1,5,9,12</p>
  
  <p>Any pointers would be great.</p>
  
  <p>thanks people.</p>