Tuesday, March 27, 2012

Do I want to use a join?

I have two tables, both containing memberID fields. One table is a membership table and the other is a list of members in a committee. So one or more memberIDs from the first table are in the second table, while every memberID in the second table is in the first table.

I need to get all the memberIDs in the first table that are NOT in the second table.

The point of this is to have two lists, one of members not on the committee and one of member that are on the committee. Add a couple of arrow buttons and the user can add or delete members for the committee.

Diane

You can get all Members not on the committee by

SELECT * FROM TableA WHERE MemberId NOT IN (SELECT MemberId FROM TableB)

|||

That was fast, thank you.

Diane

|||As soon as you validated the soultion, please mark the question as answered.|||I did, when I posted my thank you.

No comments:

Post a Comment