473,466 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Append Query Without Duplicate Rows

2 New Member
I am trying to use an append query to add data to another table i have. I have tableA and tableB. tableA has 1000 rows while tableB has 800 rows. i would like to add the other 200 rows in tableA to tableB without adding the 800 identical rows. I have an append query but there is an error that is bothering me.

INSERT INTO tableB
SELECT *
FROM tableA
WHERE NOT EXISTS (
SELECT *
FROM tableB
WHERE tableB.ID=tableA.ID)

This generates the error "The Microsoft Office Access database engine does not recognize 'tableA.ID' as a valid field name or expression". I cant seem to figure out how to resolve this error as tableA.ID is a valid field name. I can run a select query that pulls tableA.ID from tableA, but when i try to subquery it this error occurs.
Aug 3 '10 #1
2 15469
Steven Kogan
107 Recognized Expert New Member
That looks like it should work.

An alternate way that does not require a subquery is:

Expand|Select|Wrap|Line Numbers
  1. INSERT INTO tableB
  2. SELECT tableA.*
  3. FROM tableA LEFT JOIN tableB ON tableA.ID = tableB.ID
  4. WHERE (((tableB.ID) Is Null));
You'll be able use Design View with this query, which might be more intuitive.

Let me know if this works for you.
Aug 3 '10 #2
David Shears
2 New Member
Yes that worked perfectly. Thank You!
Aug 3 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: David B | last post by:
I have a form with 2 listboxes side by side. By double clicking a record in the first lb that record appears in the 2nd lb by way of a table. The record id field in the table is set to no...
3
by: Brandon M | last post by:
I'm trying to get an Update Query to overwrite any records that already exist. By default it appears to skip any records in which the key already exists. Is there any way to change this?
13
by: Lee | last post by:
Hello All, First of all I would like to say thank you for all of the help I have received here. I have been teaching myself Access for about 4 years now and I've always been able to find a...
4
by: pmacdiddie | last post by:
I have an append query that needs to run every time a line item is added to a subform. The append writes to a table that is the source for a pull down box. Problem is that it takes 5 seconds to...
7
by: pltmcs | last post by:
I am trying to generate some records from one table into another. The problem is that the new table has an autonumber field (PID). The PID is part of the primary key since it is possible to have...
4
by: Scott12345 | last post by:
Hi, here is my situation, I have a DB that tracks machine downtime (30 machines) per day. Several users will update this through the day. I created an append query that creates 30 dummy values and...
1
by: HH | last post by:
To append a single record, without getting a warning if a record already exists, I found out the following syntax works fine as Query in MS Access: first create a simple 'products' table... ...
1
AdusumalliGopikumar
by: AdusumalliGopikumar | last post by:
Please can anyone tell me how to delete duplicate rows from a table without using the pseudo column ROWID in the query Thanks in Advance
4
by: franc sutherland | last post by:
Hello, I am using Access 2003. I am having trouble trapping the "can't append all the records in the append query" error message when appending data to a query from a table which is linked to...
8
jinalpatel
by: jinalpatel | last post by:
I have two tables. tblClass and tblWithdrawn. On my main form(bound to tblClass) I have several data entry fields like Date withdrawn, Status (active or withdrawn) Date Classified etc. Also...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.