473,396 Members | 2,108 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,396 software developers and data experts.

Excluding records where two tables have the same id

Please help. I've been ramming my head on my keyboard from trying to
figure this problem out.
In a query, I have two tables. One of the tables (table 1) has a unique

identifier and other fields regarding the characteristics of that
record. In the other table (table 2), I have another list of unique
identifiers only. All unique identifiers in this table (table 2)are
contained in the first table. My goal is to exclude any records that
are in table 2 from the list in table 1.
Thanks for any help anyone is able to provide!

Nov 13 '05 #1
2 2982
he**********@hotmail.com wrote:
Please help. I've been ramming my head on my keyboard from trying to
figure this problem out.
In a query, I have two tables. One of the tables (table 1) has a unique

identifier and other fields regarding the characteristics of that
record. In the other table (table 2), I have another list of unique
identifiers only. All unique identifiers in this table (table 2)are
contained in the first table. My goal is to exclude any records that
are in table 2 from the list in table 1.
Thanks for any help anyone is able to provide!

Well, you could create a new query (Query/New/Design). Select table1
and table2. Drag/create relationship lines between Table2 and Table1
for the fields that define the uniqueness. Lets say you have fields f1,
f2, and f3 in both tables that create a unique record. Create the
relationship between those three fields. Now dbl-click on each
relationship line and select (most likely) option 2 to select all
records in Table1 and those that match in Table2. Now drag down F1..F3
in Table1 and F1..F3 in table 2. In the criteria row for F1..F3 in
Table2 enter
Is Null
and now run it. This will display all recs in Table1 that don't have a
similar record in Table2.

You might be able to create this by doing a Query/New/Missing Record.
Nov 13 '05 #2
he**********@hotmail.com wrote:
Please help. I've been ramming my head on my keyboard from trying to
figure this problem out.
In a query, I have two tables. One of the tables (table 1) has a unique

identifier and other fields regarding the characteristics of that
record. In the other table (table 2), I have another list of unique
identifiers only. All unique identifiers in this table (table 2)are
contained in the first table. My goal is to exclude any records that
are in table 2 from the list in table 1.
Thanks for any help anyone is able to provide!

Well, you could create a new query (Query/New/Design). Select table1
and table2. Drag/create relationship lines between Table2 and Table1
for the fields that define the uniqueness. Lets say you have fields f1,
f2, and f3 in both tables that create a unique record. Create the
relationship between those three fields. Now dbl-click on each
relationship line and select (most likely) option 2 to select all
records in Table1 and those that match in Table2. Now drag down F1..F3
in Table1 and F1..F3 in table 2. In the criteria row for F1..F3 in
Table2 enter
Is Null
and now run it. This will display all recs in Table1 that don't have a
similar record in Table2.

You might be able to create this by doing a Query/New/Missing Record.
Nov 13 '05 #3

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

Similar topics

8
by: duncan.lovett | last post by:
PHP 4 MySQL 4.0.20 DW MW 2004 7.01 This problem is giving me a bit of a headache, and I'm getting nowhere with it so thought I'd open it up to all, any help would be greatly appreciated. ...
8
by: tom | last post by:
I am new to SQL administration. >From a list of IDs that are the primary key in one table (i.e. Customer Table), I want to make changes in tables that use those IDs as a foreign key. ...
8
by: ric | last post by:
Hi, Is there a way to exclude fields in a query other than just including the ones you want. If there are 20 fields and you want to see all but 3, it would be a lot easier to exclude the 3. ...
10
by: DaveDiego | last post by:
I've had a user delete one of the client records, I do have a version of the DB with all records intact before the deletion occured. Whats the best approach to getting all the related records in...
0
by: henryopinion | last post by:
Please help. I've been ramming my head on my keyboard from trying to figure this problem out. In a query, I have two tables. One of the tables (table 1) has a unique identifier and other...
7
by: PC Datasheet | last post by:
Looking for suggestions ---- A database was designed for a national automobile inspection program. In it's simplest form, the database has two tables: TblOwner OwnerID <Year/Make/Model owned...
2
by: ManningFan | last post by:
Go into a table where you have a field that has NULL values. Right- Click on a record with a value in that field and choose "Filter Excluding Selection". Some (or most, or all) of your records...
11
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night)...
7
by: rohit54321 | last post by:
Hi, I have a tmp_table with say 10,000 records and a main_table with say 50 million records.. Few records of tmp_table are already existing in main_table so i need to insert only the new...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...

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.