Merge rows based on Levenshtein distance

From: mongoose <akarargyris(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Merge rows based on Levenshtein distance
Date: 2014-12-01 23:48:41
Message-ID: 1417477721526-5828841.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am new to PostgreSQL and I have the following table:

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

I want to "merge" similar rows based on levenshtein distance between names
so that I have the following table:

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

How could I do that on PostgreSQL? Is there an SQL command for this?
Thnsls

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2014-12-02 00:39:33 Re: Irreversible SET ROLE
Previous Message Melvin Davidson 2014-12-01 22:51:18 Re: Irreversible SET ROLE