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 » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to find out the difference between two tables?



 
 
Thread Tools Display Modes
  #1  
Old April 24th, 2008, 09:57 AM posted to microsoft.public.access.queries
Dawn
external usenet poster
 
Posts: 235
Default How to find out the difference between two tables?

Dear all,
My mother-tongue is not english.So if there's something I cann't express
clear,pls be tolerant,thanks.
There are two tables,with the same field definations, but not all same
records.assuming table A is a snapshot of 2008-2-29,Table B is a snapshot of
2008-3-21.the key field in both table is AccountNO.
I try to use access 2003 to find out what accounts have been opened between
2008-2-29 and 2008-3-21.
Up to now ,I only have the experience to use the parameter "join",but this
case,I need to find out the difference.
Can u do me a favor ,as to show me how to solve it in access 200? ?
pls also give me a sql sentence.
many thanks.
  #2  
Old April 24th, 2008, 01:27 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default How to find out the difference between two tables?

To show records with an AccountNo in TableB that does not exist in TableA use
a "frustrated" outer join.

For example

SELECT TableB.*
FROM TableB LEFT JOIN TableA
ON TableB.AccountNo = TableA.AccountNo
WHERE TableA.AccountNo is Null

John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County

Dawn wrote:
Dear all,
My mother-tongue is not english.So if there's something I cann't express
clear,pls be tolerant,thanks.
There are two tables,with the same field definations, but not all same
records.assuming table A is a snapshot of 2008-2-29,Table B is a snapshot of
2008-3-21.the key field in both table is AccountNO.
I try to use access 2003 to find out what accounts have been opened between
2008-2-29 and 2008-3-21.
Up to now ,I only have the experience to use the parameter "join",but this
case,I need to find out the difference.
Can u do me a favor ,as to show me how to solve it in access 200? ?
pls also give me a sql sentence.
many thanks.

  #3  
Old April 24th, 2008, 06:33 PM posted to microsoft.public.access.queries
Dale Fye
external usenet poster
 
Posts: 2,651
Default How to find out the difference between two tables?

Dawn,

You can use the query wizard to do this. Select Queries and new in the
database window. Then click the "Find Unmatched Query Wizard" option in the
list box, then click OK. The wizard will ask you which two tables to
compare, then it will ask you which fields to compare, and finally will ask
you which fields you want to display.

When you are done, take a look at the SQL view of the query. It should look
similar to what John posted.

HTH
Dale

--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



"Dawn" wrote:

Dear all,
My mother-tongue is not english.So if there's something I cann't express
clear,pls be tolerant,thanks.
There are two tables,with the same field definations, but not all same
records.assuming table A is a snapshot of 2008-2-29,Table B is a snapshot of
2008-3-21.the key field in both table is AccountNO.
I try to use access 2003 to find out what accounts have been opened between
2008-2-29 and 2008-3-21.
Up to now ,I only have the experience to use the parameter "join",but this
case,I need to find out the difference.
Can u do me a favor ,as to show me how to solve it in access 200? ?
pls also give me a sql sentence.
many thanks.

  #4  
Old April 25th, 2008, 02:01 AM posted to microsoft.public.access.queries
Dawn
external usenet poster
 
Posts: 235
Default How to find out the difference between two tables?

Dear John & Dale,
Thanks for your kindness.no matter what you help me for,u both really do me
a favor.As a chinese ,I welcome u to go to Beijin for the Olympics.
Many thanks,again.

YOurs,Dawn
 




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 11:45 PM.


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