David,

Thank you for your prompt reply. I believe your answer helped a lot but it
seems I was not clear enough on my description. Basically I want a counter
(id) to show if two or more names are similar (i.e. levenshtein distance
less than 3) So in the previous example:

>From this table: 

Name, City 
"Booob", "NYC" 
"Alex", "Washington" 
"Alexj2", "Washington" 
"Bob", "NYC" 
"Aleex1", "Washington" 

to get this table:

id, Name, City 
1,"Alex", "Washington" 
1,"Aleex1", "Washington" 
1,"Alexj2", "Washington" 
2,"Bob", "NYC" 
2,"Booob", "NYC" 

So basically the id is a counter that starts from "1" and increments only
when there is a different name. Please notice that the table has its names
in a completely random order.





--
View this message in context: 
http://postgresql.nabble.com/Merge-rows-based-on-Levenshtein-distance-tp5828841p5829030.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to