【发布时间】:2013-03-21 06:05:00
【问题描述】:
我的 postgresql 表有一个 (cityname) 列。 (cityname) 列中的值有一些拼写错误。需要更正列(城市名称)的每条记录。另一个表有一列包含所有正确的城市名称。根据此表,需要更正第一个表的拼写错误。
【问题讨论】:
-
能否请您附上您已经编写的代码,并解释它的哪一部分给您带来了问题?
-
Select * from table_1 A,table_2 B where A.add3=B.address and custno not in (Select custno from table_1 A,table_2 B where A.add2=B.address and custno not in (从 table_1 A,table_2 B 中选择 custno,其中 A.add1=B.address )) 和 custno in (Select distinct(B.custno) from table a,table b where acctstat in (1,2) 和 A.custno = B。 custno)
-
通过上述查询,我只能加入几条记录
-
也许您需要查看 Levenshtein distances 之类的内容 - 这些可以帮助您根据将一个字符串更改为另一个字符串所需的更改次数来确定最可能匹配拼写错误的单词。
标签: sql postgresql-9.2