Results 1 to 3 of 3
  1. #1
    hrghauri is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2016
    Location
    Ottawa, Ontario, Canada
    Posts
    11

    Sql query to find everything about the students who are not registered in a particular class

    Suppose I have three tables Student, Class, Student_Class(linking table).
    Table:Student
    Student_ID
    FirstName
    LastName

    Table:Class
    Class_ID
    Class_name

    Table:Student_Class (Linking Table)
    StudentClass_ID
    Class_ID
    Student_IDGiven a particular Class_ID, I want to know everything about the students who are not registered for that particular class.
    I tried the following but it does not work. Lets say I try for class id = 3
    SELECT DISTINCT Student.*
    FROM Student
    INNER JOIN Student_Class


    ON Student.Student_ID = Student_Class.Student_ID
    WHERE ((NOT (Student_Class.Class_ID)= 3))

  2. #2
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,463
    WHERE (((Student_Class.Class_ID)<>3));

  3. #3
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    in query design view add the Students table and the Students_Class table.

    make a join line between the common StudentClass_ID fields so that it is an arrow facing the Students_Class table

    add all fields; in the Students_Class.Student_ID field add the criteria: Is Null
    in the Students_Class.Class_ID field add criteria for whichever class you wish i.e. 3

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 10
    Last Post: 11-05-2015, 02:22 PM
  2. Replies: 1
    Last Post: 10-29-2015, 08:36 AM
  3. SQL query to select eligible students
    By Alex_738 in forum Queries
    Replies: 6
    Last Post: 06-03-2014, 12:48 PM
  4. find students with GPA 3.0 and above
    By primobolan in forum Access
    Replies: 1
    Last Post: 11-08-2013, 07:50 PM
  5. Query showing only those students who have graduated
    By snowboarder234 in forum Queries
    Replies: 1
    Last Post: 07-26-2013, 10:54 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums