我如何使用MS访问SQL LIKE语句 [英] How do I use MS access SQL LIKE statement

查看:71
本文介绍了我如何使用MS访问SQL LIKE语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张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 & "%')"

推荐答案

您可以使用 REPLACE 从字符串中删除所有空格(未经测试):

You can use REPLACE to remove all spaces from a string (untested):
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".


Like Operator - Access [ ^ ]。


这篇关于我如何使用MS访问SQL LIKE语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆