A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How do I append non-matching records



 
 
Thread Tools Display Modes
  #1  
Old May 19th, 2010, 07:22 PM posted to microsoft.public.access.gettingstarted
OMI
external usenet poster
 
Posts: 4
Default How do I append non-matching records

I want to append records to tableB only when the key field in tableA does not
match the key field in tableB
  #2  
Old May 19th, 2010, 07:33 PM posted to microsoft.public.access.gettingstarted
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default How do I append non-matching records

Omi

We're not there. We can't see your tables or relationships.

Are you saying that you have two tables with identical structure, and you're
adding to one table only if the record isn't already in another table? If
so, why?! In a well-normalized relational database, you usually don't
need/have multiple tables with the same structure.

More info, please...

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Omi" wrote in message
...
I want to append records to tableB only when the key field in tableA does
not
match the key field in tableB



  #3  
Old May 19th, 2010, 07:43 PM posted to microsoft.public.access.gettingstarted
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default How do I append non-matching records

INSERT INTO TableB (ID, Field1, Field2, Field3)
SELECT ID, Field1, Field2, Field3
FROM TableA
WHERE TableA.ID NOT IN (SELECT DISTINCT ID FROM TableB)

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

"Omi" wrote in message
...
I want to append records to tableB only when the key field in tableA does
not
match the key field in tableB



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:55 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.