使用通配符查询两个表和重复项 [英] Query two tables and duplicates with wildcards

查看:85
本文介绍了使用通配符查询两个表和重复项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。


我正在比较两个表[客户]和[工作簿]


我试图识别,在表[WorkBook]放置在公司的位置。字段与Customers.Company类似或相同。
我现在能够成功识别完全匹配,但我需要的是在我的搜索功能的任一侧放置通配符。 br />

我有以下SQL语句

展开 | 选择 | Wrap | 行号

解决方案

尝试

展开 | 选择 | Wrap | 行号


嗨Phil,


我尝试了如下:


SELECT WorkBook.ID, WorkBook.Authorname,WorkBook.FirstName,WorkBook.LastName,WorkBook.Title,WorkBook.Email,WorkBook.Company,WorkBook。[Lead Status]


来自WorkBook LEFT JOIN客户在WorkBook上。 [公司] =客户。[公司]


WHERE(((Customers.Company)喜欢" *" &安培; [WorkBook.Company]& " *"));



这与我上面发布的查询产生的结果相同。


我的WorkBook.Company字段中有FirstEnergy Inc在我的Customers.Company字段中,我有FirstEnergy并且此查询没有从工作簿中提取记录。


应该注意的是,通过调整,它还会提取完全匹配,但不会提取变量(通配符);这正是我在原始查询中遇到的错误。


给出一个镜头,不要认为表可以加入:

展开 < span class =codeDivider> | 选择 | Wrap | Line编号

Hello to all.

I am comparing two tables [Customers] and [Workbook]

I am trying to identify, in the table [WorkBook] places where the "Company" field is similar or the same to the Customers.Company

I am now able to successfully identify exact matches, but what I need is to place wildcards on either side of my search function.

I have the following SQL statement

Expand|Select|Wrap|Line Numbers

解决方案

Try

Expand|Select|Wrap|Line Numbers


Hi Phil,

I tried it as follows:

SELECT WorkBook.ID, WorkBook.Authorname, WorkBook.FirstName, WorkBook.LastName, WorkBook.Title, WorkBook.Email, WorkBook.Company, WorkBook.[Lead Status]

FROM WorkBook LEFT JOIN Customers ON WorkBook.[Company] = Customers.[Company]

WHERE (((Customers.Company) Like "*" & [WorkBook.Company] & "*"));



This produced the same results as the query I posted above.

I have in my WorkBook.Company field "FirstEnergy Inc" and in my Customers.Company field I have "FirstEnergy" and this query did not pull the record from WorkBook.

It should be noted that with your adjustment it also pulls the exact matches, but not the variations (wildcards) ; This is exactly the error I encountered with my original query.


Give this a shot, don''t think the Tables can be joined:

Expand|Select|Wrap|Line Numbers


这篇关于使用通配符查询两个表和重复项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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