Jump to content

Recommended Posts

Thanks for your help.  I tried your query but there are still issues.  If the student is enrolled in more than 1 class, lets say student #1, he will still show in query results. 

 

Also, I would like to get a list of all students who are not enrolled in the particular class, not only the ones listed in the enrollment table.  Sorry if this is confusing. 

 

Link to comment
https://forums.phpfreaks.com/topic/155445-sql-join-headache/#findComment-818120
Share on other sites

I could not modify the post above so I am posting this as edit to make it more clear.

 

If I ran the following:

SELECT s.name FROM students s LEFT JOIN enrollment e ON s.student_id = e.student_id WHERE e.class_id != 2

 

I get the following results:

 

Mary

Terry

John

Mark

 

Isues:

Terry should not be listed. 

 

Also, Stephanie, James and Irena should be listed.  Hope this is more clear.

Link to comment
https://forums.phpfreaks.com/topic/155445-sql-join-headache/#findComment-818129
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.