我想做什么;PostgresSQL:使用来自两个表格的模糊匹配的地址匹配
我有两个表有两个地址列,都存储为text
我想创建一个视图返回匹配的行。
我试过了;
我已经创建和索引的列和表如下;
CREATE INDEX idx_table1_fulladdress ON table1 (LOWER(fulladdress_ppd));
然后运行以下;
CREATE OR REPLACE VIEW view_adresscheck AS
SELECT
--from table1
table1.postcode,
table1.fulladdress_ppd,
--from table2
table2.epc_postcode,
table2.fulladdress_epc
FROM
table1,
table2
WHERE
table1.postcode = table2.epc_postcode
AND
table2.fulladdress_epc = table1.fulladdress_ppd ::text;
什么没有奏效 以上恢复较少的记录比我知道在那里。在检查时,这是因为两个表格之间的地址格式不一致。
table1.fulladdress_ppd = Flat 2d The building the street
table2.fulladdress_epc = Flat 2/d The building the street, the town
的地址不一致格式化table
要么即表中不是所有的地址包括城市,所以我不能使用regex
或trim
批量干净。
我已经在postgres中看到了fuzzystrmatch
module,这听起来像它可能会解决我的问题。
问题 其中探测法,莱文斯坦的,音位是最合适的。大多数记录都是英文的,一些地名是Gaelic在9.6上运行的。感谢任何帮助
请尽量不要在多个问题上传播类似问题。参考你以前的问题。 https://stackoverflow.com/questions/44587680/postgres-db-performance-for-split-vs-concatenate-when-matching – Mokadillion