Re: Merge rows based on Levenshtein distance

Поиск
Список
Период
Сортировка
От mongoose
Тема Re: Merge rows based on Levenshtein distance
Дата
Msg-id 1417583153333-5829030.post@n5.nabble.com
обсуждение исходный текст
Ответ на Re: Merge rows based on Levenshtein distance  (David G Johnston <david.g.johnston@gmail.com>)
Ответы Re: Merge rows based on Levenshtein distance  (David G Johnston <david.g.johnston@gmail.com>)
Список pgsql-general
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.


В списке pgsql-general по дате отправления:

Предыдущее
От: Nelson Green
Дата:
Сообщение: Re: Programmatic access to interval units
Следующее
От: Paul GOERGLER
Дата:
Сообщение: Re: Is "WITH () UPDATE" Thread Safe ?