473,414 Members | 1,954 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Compare one field in a table with a 3 fields in another table

Hi,

I have a small problem I am trying to check if field1 in Table1 matches
Field2, Field3 or Field4 in Table2: ie

Record 1
Table1
Field1 = ABC

Table2
Field1 = 44g
Field2 = ABC (this is matching field)
Field3 = rgrg

Record 2
Table1
Field1 = 123

Table2
Field1 = 123 (this is matching field)
Field2 = xx
Field3 = asd

Record 3
Table1
Field1 = xxx

Table2
Field1 = asd
Field2 = 123
Field3 = xxx (this is matching field)

Record 4
Table1
Field1 = 555

Table2
Field1 = ABC
Field2 = dsf
Field3 = ""

No matching field in Record4

As you can see the "matching" field could be in Field1, 2 or 3 in
Table2. I want to display all the records were there is no matching
field(s) in Table2 at all (whether in Field1, 2 or 3 in Table2)as in
record 4 (this is what i would like to be displayed)

Hope this maker sense

Thankyou very much

Flick. x

Nov 13 '05 #1
1 1711
One approach would be a query like the following:

SELECT Test1.*
FROM Test1 LEFT JOIN TEST2 ON (Test1.Field1 = TEST2.Field1) OR (Test1.Field1
= TEST2.Field2) OR (Test1.Field1 = TEST2.Field3)
WHERE Test2.Field1 is null;

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.
<ge*********@hotmail.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
Hi,

I have a small problem I am trying to check if field1 in Table1 matches
Field2, Field3 or Field4 in Table2: ie

Record 1
Table1
Field1 = ABC

Table2
Field1 = 44g
Field2 = ABC (this is matching field)
Field3 = rgrg

Record 2
Table1
Field1 = 123

Table2
Field1 = 123 (this is matching field)
Field2 = xx
Field3 = asd

Record 3
Table1
Field1 = xxx

Table2
Field1 = asd
Field2 = 123
Field3 = xxx (this is matching field)

Record 4
Table1
Field1 = 555

Table2
Field1 = ABC
Field2 = dsf
Field3 = ""

No matching field in Record4

As you can see the "matching" field could be in Field1, 2 or 3 in
Table2. I want to display all the records were there is no matching
field(s) in Table2 at all (whether in Field1, 2 or 3 in Table2)as in
record 4 (this is what i would like to be displayed)

Hope this maker sense

Thankyou very much

Flick. x
Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Simon Gare | last post by:
Hi I need to compare a dynamic field in an asp page to a field in another table, if there is no match then i would like to chane the row colour ( see code below). The problem Im having is...
2
by: Rachel Curran | last post by:
Please can anybody help me with the following: I have two separate excel spreadsheets that I have imported into access, each sheet holds the same fields. Both spreadsheets hold all information...
5
by: Megan | last post by:
Hi everybody- I'm helping a friend with a music database. She has an old one and is creating a new one. She wants to compare records and fields in the old database with records and fields in the...
2
by: Megan | last post by:
Hi everybody- I have 2 tables, Hearings and Rulings. Both have primary keys called, CaseID, that are autonumbers. I don't want both tables to have the same autonumber. For example, if Hearings...
9
by: geronimo_me | last post by:
Hi, I am atempting to compare part of a field with the whole of another field in access. Is this possible? Basically I have 2 tables with the following info: Table1 Field1 = MR.
9
by: VMI | last post by:
I have two tables and I want to compare these two tables with a query( ie. "select * from A where B.key = A.key") and the result will be stored in a 3rd table (table C). is this possible? If...
5
by: Edd E | last post by:
Hi, I have a database to store my analyses (Access 2002, WinXp), the basic structure is: TABLE 1 = Sample Info TABLE 2 = Analysis type 1 TABLE 3 = Analysis type 2 TABLE 4 = Analysis type 3 ...
2
by: pmelan | last post by:
Hi everyone. I wasn't sure how to describe what I want in the subject line so hopefully this post will allow me to further explain. I have a table where I have names of people who have filed...
1
by: Nick | last post by:
Does anyone know if there is an easy way to compare a row from table a, to a row in table b with the same structure/field names and return those fields which don't match? I have table_a storing...
6
osward
by: osward | last post by:
Hi everyone, I have query(s) that I need to perform which I couldn't figure out, and following is the situation I have event table (which stores the event details) that has eid, date, time,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.