Excluded Results from a join

G

Guest

Two table exist, there are some records in both tables that are the same, but
both tables hold other characteristics relating to those records.

e.g both tables hold a Transaction Code Field, I need to exclude the
Overlapping records from Table A and return the remaining records from this
table......
How do I do this?
 
B

Baz

SELECT TableA.* FROM TableA LEFT JOIN TableB ON TableA.[Transaction Code] =
TableB.[Transaction Code] WHERE TableB.[Transaction Code] IS NULL
 
G

Guest

Thank you very much Baz, that worked perfectly, just to be a bit more
specific, lect say you wanted the join key to be more that one field i.e.
Trans_Date also how should the syntax be then


Baz said:
SELECT TableA.* FROM TableA LEFT JOIN TableB ON TableA.[Transaction Code] =
TableB.[Transaction Code] WHERE TableB.[Transaction Code] IS NULL

AccessHar said:
Two table exist, there are some records in both tables that are the same, but
both tables hold other characteristics relating to those records.

e.g both tables hold a Transaction Code Field, I need to exclude the
Overlapping records from Table A and return the remaining records from this
table......
How do I do this?
 
G

Guest

It's OK Baz I used was able to alter the syntax you gave very kindly and I
now have the following which gives the correct results:

SELECT TBL_TRANS_LOAD_RECORDS.*
FROM TBL_TRANS_LOAD_RECORDS LEFT JOIN TBL_CARD_LOAD_RECORDS ON
(TBL_TRANS_LOAD_RECORDS.[CARD NUM] = TBL_CARD_LOAD_RECORDS.[CARD NUM]) AND
(TBL_TRANS_LOAD_RECORDS.TRANSACTION = TBL_CARD_LOAD_RECORDS.TRANS) AND
(TBL_TRANS_LOAD_RECORDS.[TRANS DATE] = TBL_CARD_LOAD_RECORDS.[TRANS DATE])
WHERE (((TBL_CARD_LOAD_RECORDS.[TRANS DATE]) Is Null) AND
((TBL_CARD_LOAD_RECORDS.[CARD NUM]) Is Null) AND
((TBL_CARD_LOAD_RECORDS.TRANS) Is Null));


Thank you Again.....

AccessHar said:
Thank you very much Baz, that worked perfectly, just to be a bit more
specific, lect say you wanted the join key to be more that one field i.e.
Trans_Date also how should the syntax be then


Baz said:
SELECT TableA.* FROM TableA LEFT JOIN TableB ON TableA.[Transaction Code] =
TableB.[Transaction Code] WHERE TableB.[Transaction Code] IS NULL

AccessHar said:
Two table exist, there are some records in both tables that are the same, but
both tables hold other characteristics relating to those records.

e.g both tables hold a Transaction Code Field, I need to exclude the
Overlapping records from Table A and return the remaining records from this
table......
How do I do this?
 
B

Baz

Well done! Glad to have been of assistance.

AccessHar said:
It's OK Baz I used was able to alter the syntax you gave very kindly and I
now have the following which gives the correct results:

SELECT TBL_TRANS_LOAD_RECORDS.*
FROM TBL_TRANS_LOAD_RECORDS LEFT JOIN TBL_CARD_LOAD_RECORDS ON
(TBL_TRANS_LOAD_RECORDS.[CARD NUM] = TBL_CARD_LOAD_RECORDS.[CARD NUM]) AND
(TBL_TRANS_LOAD_RECORDS.TRANSACTION = TBL_CARD_LOAD_RECORDS.TRANS) AND
(TBL_TRANS_LOAD_RECORDS.[TRANS DATE] = TBL_CARD_LOAD_RECORDS.[TRANS DATE])
WHERE (((TBL_CARD_LOAD_RECORDS.[TRANS DATE]) Is Null) AND
((TBL_CARD_LOAD_RECORDS.[CARD NUM]) Is Null) AND
((TBL_CARD_LOAD_RECORDS.TRANS) Is Null));


Thank you Again.....

AccessHar said:
Thank you very much Baz, that worked perfectly, just to be a bit more
specific, lect say you wanted the join key to be more that one field i.e.
Trans_Date also how should the syntax be then


Baz said:
SELECT TableA.* FROM TableA LEFT JOIN TableB ON TableA.[Transaction Code] =
TableB.[Transaction Code] WHERE TableB.[Transaction Code] IS NULL

Two table exist, there are some records in both tables that are the same,
but
both tables hold other characteristics relating to those records.

e.g both tables hold a Transaction Code Field, I need to exclude the
Overlapping records from Table A and return the remaining records from
this
table......
How do I do this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top