Query Assist Please

  • Thanks for taking a look at this! I'm sure there is a simple solution to this, but so far I've not been able to find it. Here goes...

    I've got two tables as shown below:

    Members Dues

    MemID DuesID

    MemName MemID

    DatePaid

    DuesYear

    I want to select the members(MemName) who have not paid their dues for a particular year (DuesYear). So let's say I'm looking for the year 2007. If a member does not have a record in the dues table for DuesYear 2007, I want to select that member. I'm obviously having no problem selecting them if they do have a record with DuesYear 2007, but can't seem to figure out how to get them if they do not.

    Any help would be greatly appreciated!

    Thanks!

  • keverage (2/28/2008)


    Thanks for taking a look at this! I'm sure there is a simple solution to this, but so far I've not been able to find it. Here goes...

    I've got two tables as shown below:

    Members Dues

    MemID DuesID

    MemName MemID

    DatePaid

    DuesYear

    I want to select the members(MemName) who have not paid their dues for a particular year (DuesYear). So let's say I'm looking for the year 2007. If a member does not have a record in the dues table for DuesYear 2007, I want to select that member. I'm obviously having no problem selecting them if they do have a record with DuesYear 2007, but can't seem to figure out how to get them if they do not.

    Any help would be greatly appreciated!

    Thanks!

    Hello,

    It can be queried as

    SELECT MemName

    FROM Members

    WHERE MemID NOT IN (SELECT MemID FROM Dues)

    Hope this helps.

    Thanks


    Lucky

  • Thanks so much! That did the trick. I knew there had to be a simple solution and I was making it harder than it needed to be! Thanks again!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply