使用部分值连接查询中的字段 [英] Joining fields in queries using partial values

查看:33
本文介绍了使用部分值连接查询中的字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于加入查询的问题。我有2个表,其中一个字段名为

" ID"。


表1

Rec1 = Jan12FredFlintstone

Rec2 = Feb01WilmaRubble


表2

Rec1 = Jan12BarneyRubble

Rec2 = Mar03SamSlate

我正在尝试写一个查询,告诉我显示所有值

Left([table 1]。[id],5)= Left([table2]。[ ID],5)。我不知道如何将
输入到查询窗口中。我是否需要以某种方式加入表格?

我尝试添加两个表而不加入并输入

参数,就像我上面的那样,但是系统冻结了。如果重要的话,我在每张桌子上都有30,000条记录




我不想创建一个只有左边5个的新字段ID

字段如果不需要。


谢谢,

D

解决方案

这个设计是一个严重的坏消息。你不能在部分

比赛中创建联接。你有一场比赛,或者你不是。在

查询中拆分值,然后尝试加入生成的查询。


2006年9月6日12:24:49 -0700,ve *** @ aol.com < ve *** @ aol.comwrote:


当然有效。下面是使用Northwind示例的示例

数据库:

SELECT Customers.CustomerID,Employees.EmployeeID,

Customers.ContactName,Employees.FirstName ,Employees.LastName

来自客户,员工

WHERE((左


([ContactName],5)=左

Question about joins in queries. I have 2 tables with a field called
"ID".

Table 1
Rec1 = Jan12FredFlintstone
Rec2 = Feb01WilmaRubble

Table 2
Rec1 = Jan12BarneyRubble
Rec2 = Mar03SamSlate

I''m trying to write a query that says show me all values where
Left([table 1].[id],5) = Left([table2].[id],5). I don''t know how to
enter this into a query window. Do I need to join the tables somehow?
I tried just adding both tables without joining and entering the
parameters like I have above, but system froze. I have 30,000 records
in each table if that matters.

I don''t want to create a new field that just has the left 5 of the ID
field if it''s not needed.

Thanks,
D

解决方案

This design is serious bad news. You can''t create joins on partial
matches. You either have a match or you don''t. Split the values in a
query, then try joining the resulting queries.


On 6 Sep 2006 12:24:49 -0700, "ve***@aol.com" <ve***@aol.comwrote:

Sure that works. Here is an example using the Northwind sample
database:
SELECT Customers.CustomerID, Employees.EmployeeID,
Customers.ContactName, Employees.FirstName, Employees.LastName
FROM Customers, Employees
WHERE ((Left


([ContactName],5)=Left


这篇关于使用部分值连接查询中的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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