问题描述
我有一张MS Access(2007)表格。
表格中的一列(名为BD_Name)包含一个值=
All - In - One Driving Academy 。
我试图选择值为=
All-In-One Driving Academy的记录,即SupplierName。
注意 - 之间的空格(或缺少空格)。
我正在尝试合并供应商和他们的银行业务详细信息,从不相关的表格和不同的人填充,每个人都有自己的供应商名称应该是什么。
有没有我可以找到那条记录吗?
SQL语句由VB.net(4.0)程序发布。
我们非常感谢您的建议和帮助。
我的尝试:
I have a MS Access(2007) table.
A column (called BD_Name) in the table contains a value =
"All - In - One Driving Academy".
I am trying to select that record with the value =
"All-In-One Driving Academy" ie SupplierName.
Note the spaces (or lack thereof) between the "-"'s.
I am trying to merge Suppliers and their Banking details from tables that were never related and populated by different people each with their own sense of what the supplier name should be.
Is there any way I can find that record?
The SQL statement is being issued by a VB.net (4.0) program.
Your advice and assistance, as always, is much appreciated.
What I have tried:
Ssql = "SELECT BD_Name, BD_AcNo, BD_BranchCode, BD_Bank FROM Supplier_Pastel_Bank_Details WHERE LCASE([Supplier_Pastel_Bank_Details.BD_Name]) LIKE LCASE('%" & SupplierName & "%')"
推荐答案
WHERE LCASE(REPLACE([Supplier_Pastel_Bank_Details.BD_Name], ' ', '') LIKE LCASE(REPLACE('%" & SupplierName & "%'), ' ', '')"
但我建议手动检查结果以避免误报。
在您的情况下,可能还需要忽略踪迹与公司公司和公司公司一样的点。
But I suggest to check the results manually to avoid false positives.
In your case it might be also necessary to ignore trailing dots like with "Company Inc." and Company Inc".
这篇关于我如何使用MS访问SQL LIKE语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!