May 6, 2009 at 2:15 pm
Hello,
I need to check the students in one table A that are not in another table A.
Table A: I have some fields like firstname, lastname, birthdate.......
table B: I have the same fields above and other different columns.
Although I know it's good have some fields like studentID, to identify and join tables, but for our case, we cannot depend on the student ID.
So I would like to check what students in table B are not in Table A, join by lastname, firstname, and birthdate.
Thanks
May 6, 2009 at 2:27 pm
Check out EXCEPT operator in BOL. Basic query would be this:
SELECT
Last_Name,
First_Name,
Birth_Date
FROM
dbo.TableA
EXCEPT
SELECT
Last_Name,
First_Name,
Birth_Date
FROM
dbo.TableB
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
May 6, 2009 at 2:42 pm
It works great.
Thanks
By the way is this EXcept only works in SQL?
Is it working in Microsoft Access, don't think so.
If the same situation in Access, how can I do it?
Thanks
May 6, 2009 at 2:55 pm
Well ACCESS does support OUTER JOIN's so you could use a LEFT OUTER JOIN. The LEFT OUTER JOIN would work in SQL Server too, but EXCEPT is easier.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
May 6, 2009 at 2:58 pm
Thanks a lot
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply