Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Jerusalem, Israel
    Posts
    708
    Thanks
    0
    Thanked 1 Time in 1 Post

    Not Query (XP/2K)

    I have a database for class records. Table Students has the names and table attendance has the Class and Section . They are linked by Student #. There is a requirement to take a class on Sunday on 9 AM. How can I query who is NOT taking any of the 4 classes offered them. Each class has sections so it needs to choose only the section offered at 9AM Sunday.
    I tired the following which did not work.

    SELECT DISTINCT MACHAL_STUDENT.FAM_NAM, MACHAL_STUDENT.FIR_NAM
    FROM MACHAL_STUDENT INNER JOIN MACHAL_ATTENDANCE ON (MACHAL_STUDENT.STUDNT_NO = MACHAL_ATTENDANCE.STUDNT_NO) AND (MACHAL_STUDENT.AC_YEAR = MACHAL_ATTENDANCE.AC_YEAR)
    WHERE (((MACHAL_STUDENT.AC_YEAR)="2003-04") AND (Not (MACHAL_ATTENDANCE.COURSE)=252) AND (Not (MACHAL_ATTENDANCE.SECTION)="A")) OR (((MACHAL_STUDENT.AC_YEAR)="2003-04") AND (Not (MACHAL_ATTENDANCE.COURSE)=14) AND (Not (MACHAL_ATTENDANCE.SECTION)="A")) OR (((MACHAL_STUDENT.AC_YEAR)="2003-04") AND (Not (MACHAL_ATTENDANCE.COURSE)=53) AND (Not (MACHAL_ATTENDANCE.SECTION)="B")) OR (((MACHAL_STUDENT.AC_YEAR)="2003-04") AND (Not (MACHAL_ATTENDANCE.COURSE)=14) AND (Not (MACHAL_ATTENDANCE.SECTION)="A"));


    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Not Query (XP/2K)

    I would build two queries:

    (1) A query that returns all students who attend one of the Sunday 9 AM courses.
    (2) A query created with the Find Unmatched Query Wizard that returns all records from the Students table that have no corresponding record in the query from (1). Use Student_No as link field.

  3. #3
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Jerusalem, Israel
    Posts
    708
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Not Query (XP/2K)

    I was hoping there was a away in one query.
    Oh Well

Posting Permissions

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