Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    2

    Unanswered: Query/Table Join

    Hey guys,

    I need to perform a query on two tables that look like this:

    ATTENDANCE
    attendanceid
    memberid
    meetingid
    meetingdate

    MEMBERS
    memberid
    firstname
    lastaname

    I can run this query just fine:

    select m.memberid from members m, attendance a where
    a.meetingid = 47 and m.memberid = a.memberid

    This gives me memberid's for members that are present.

    I need members that are not present.

    select m.memberid from members m, attendance a where
    a.meetingid = 47 and m.memberid <> a.memberid

    This returns a thousand rows when it should return no more than 25.

    I am sure this is just a simple join but I do not have my SQL for dummies book with me at the moment ;-)

    Thanks,

    Mike

  2. #2
    Join Date
    Mar 2004
    Posts
    80

    Re: Query/Table Join

    I guess this is what u r trying for.

    select memberid from members where memberid not in(select memberid from attendance where meetingid = 47)

    Originally posted by mycoolross
    Hey guys,

    I need to perform a query on two tables that look like this:

    ATTENDANCE
    attendanceid
    memberid
    meetingid
    meetingdate

    MEMBERS
    memberid
    firstname
    lastaname

    I can run this query just fine:

    select m.memberid from members m, attendance a where
    a.meetingid = 47 and m.memberid = a.memberid

    This gives me memberid's for members that are present.

    I need members that are not present.

    select m.memberid from members m, attendance a where
    a.meetingid = 47 and m.memberid <> a.memberid

    This returns a thousand rows when it should return no more than 25.

    I am sure this is just a simple join but I do not have my SQL for dummies book with me at the moment ;-)

    Thanks,

    Mike

  3. #3
    Join Date
    Mar 2004
    Posts
    2
    THANK YOU!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •