JohnDubya
03-08-2007, 04:21 PM
There are four tables being used in my problem.
"Person" table, primary key is PersonID, with each person's name, email, etc.
"Chapter" table, primary key is ChapterID, with info about each of our chapters (one is selected when using our site).
"Student" table with a PersonID column that associates the row with info from the Person table and a ChapterID column to tie the row to the Chapter table.
And "smallgroup_students" table with a person_id column that ties to the Person table.
So what I'm trying to do is find any student who is not in a small group. Sounds easy...but I'm stumped. I'm finding that the guy who built this DB was not the smartest cookie, but I've got to deal with it.
So here's the logic I need put into a query:
SELECT every student FROM the tables listed above
WHERE the Student.PersonID equals the Person.PersonID
AND the Student.ChapterID equals the currently selected ChapterID
AND the Student.PersonID is not in smallgroup_students.person_id
Hope this makes sense. Let me know if not.
"Person" table, primary key is PersonID, with each person's name, email, etc.
"Chapter" table, primary key is ChapterID, with info about each of our chapters (one is selected when using our site).
"Student" table with a PersonID column that associates the row with info from the Person table and a ChapterID column to tie the row to the Chapter table.
And "smallgroup_students" table with a person_id column that ties to the Person table.
So what I'm trying to do is find any student who is not in a small group. Sounds easy...but I'm stumped. I'm finding that the guy who built this DB was not the smartest cookie, but I've got to deal with it.
So here's the logic I need put into a query:
SELECT every student FROM the tables listed above
WHERE the Student.PersonID equals the Person.PersonID
AND the Student.ChapterID equals the currently selected ChapterID
AND the Student.PersonID is not in smallgroup_students.person_id
Hope this makes sense. Let me know if not.