sql advice

Sims, John ayu8 at cdc.gov
Tue Jan 24 09:49:43 CST 2006


> 
> Still no go unfortunately.  This only returns the teachers 
> and classes that have students.  As you said, I need all 
> teachers and classes, whether they have students or not.
> 
> I know this seems like it should work, but it doesn't unless 
> I remove the SchoolYear condition.  But I need to be able to 
> filter the records by SchoolYear, otherwise I'm in trouble.
> 
> Thanks.
> 
> 
> On Jan 24, 2006, at 3:06 AM, Ruslan Zasukhin wrote:
> 
> >
> > Teachers.RecID = Classes.TeacherPtr AND Classes.RecID *= 
> > StudentClass.ClassPtr AND StudentClass.StudentYearPtr = 
> > StudentYear.RecID AND StudentYear.StudentPtr = Students.RecID
> 
> ------------------------------------------
> Chris Sheffield
> Read Naturally
> The Fluency Company
> http://www.readnaturally.com
> ------------------------------------------

Hi Chris,

Try this:

SELECT Teachers.FirstName, Teachers.LastName, Classes.ClassName,
Classes.Reading, Students.FirstName, Students.LastName,
StudentYear.Grade, Teachers.Type, Teachers.RecID 
FROM Teachers, Classes, Students, StudentClass, StudentYear 
WHERE Teachers.RecID*=Classes.TeacherPtr
AND Classes.RecID*=StudetClass.ClassPtr
AND StudentClass.StudentYearPtr*=StudentYear.RecID
AND StudentYear.StudentPtr*=Students.RecID
AND StudentYear.SchoolYear='2005' 
AND Teachers.Active=1

This should give you all Teachers, all Classes as long as a Teacher is
assigned to the class, and then the other info you are looking for.

I hope this works.  It is kind of hard to know for sure without seeing
the actual data.

Good luck,

-John


More information about the Valentina mailing list