Note: This code is written and intended for use in Microsoft Access and will not work in the SQL Server Query Analyzer.



SELECT

dbo_EA7RECORDS.LASTNAME, dbo_EA7COURSES.COURSENAME, dbo_EA7ACADEMICYEARS.DESCRIPTION,

dbo_EA7TRANSLATIONENTRIES.GRADE, dbo_TABLEENTRIES.DESCRIPTION, dbo_EA7STUDENTGRADES.EA7STUDENTCOURSESID,

(SELECT CLASSSECTION FROM dbo_EA7Classes A WHERE A.EA7CLASSESID=dbo_EA7Classes.EA7CLASSESID) AS ClassSession,

dbo_EA7RECORDS_1.LASTNAME



FROM

((((((((((((((((dbo_EA7TRANSLATIONENTRIES INNER JOIN dbo_EA7STUDENTGRADES ON

dbo_EA7TRANSLATIONENTRIES.EA7TRANSLATIONENTRIESID = dbo_EA7STUDENTGRADES.EA7TRANSLATIONENTRIESID)

INNER JOIN dbo_EA7STUDENTCOURSES ON dbo_EA7STUDENTGRADES.EA7STUDENTCOURSESID = dbo_EA7STUDENTCOURSES.EA7STUDENTCOURSESID)

INNER JOIN dbo_EA7COURSES ON dbo_EA7STUDENTCOURSES.EA7COURSESID = dbo_EA7COURSES.EA7COURSESID)

INNER JOIN (dbo_EA7SESSIONS INNER JOIN dbo_EA7ACADEMICYEARS ON

dbo_EA7SESSIONS.EA7ACADEMICYEARSID = dbo_EA7ACADEMICYEARS.EA7ACADEMICYEARSID) ON

dbo_EA7STUDENTCOURSES.EA7SESSIONSID = dbo_EA7SESSIONS.EA7SESSIONSID)

INNER JOIN (dbo_EA7STUDENTS INNER JOIN dbo_EA7RECORDS ON dbo_EA7STUDENTS.EA7RECORDSID = dbo_EA7RECORDS.EA7RECORDSID)

ON dbo_EA7STUDENTCOURSES.EA7STUDENTSID = dbo_EA7STUDENTS.EA7STUDENTSID) INNER JOIN dbo_EA7MARKINGCOLUMNS ON

dbo_EA7STUDENTGRADES.EA7MARKINGCOLUMNSID = dbo_EA7MARKINGCOLUMNS.EA7MARKINGCOLUMNSID)

INNER JOIN dbo_TABLEENTRIES ON dbo_EA7MARKINGCOLUMNS.DESCRIPTION = dbo_TABLEENTRIES.TABLEENTRIESID)

INNER JOIN dbo_EA7STUDENTCOURSETERMS ON

dbo_EA7STUDENTCOURSES.EA7STUDENTCOURSESID = dbo_EA7STUDENTCOURSETERMS.EA7STUDENTCOURSESID)

INNER JOIN dbo_EA7CLASSTERMS ON dbo_EA7STUDENTCOURSETERMS.EA7CLASSTERMSID = dbo_EA7CLASSTERMS.EA7CLASSTERMSID)

INNER JOIN dbo_EA7CLASSES ON dbo_EA7CLASSTERMS.EA7CLASSESID = dbo_EA7CLASSES.EA7CLASSESID)

INNER JOIN dbo_EA7CLASSTERMMEETINGS ON dbo_EA7CLASSTERMS.EA7CLASSTERMSID = dbo_EA7CLASSTERMMEETINGS.EA7CLASSTERMSID)

LEFT JOIN dbo_EA7FACULTYCLASSTERMMEETINGS ON

dbo_EA7CLASSTERMMEETINGS.EA7CLASSTERMMEETINGSID = dbo_EA7FACULTYCLASSTERMMEETINGS.EA7CLASSTERMMEETINGSID)

LEFT JOIN dbo_EA7FACULTY ON dbo_EA7FACULTYCLASSTERMMEETINGS.EA7FACULTYID = dbo_EA7FACULTY.EA7FACULTYID)

LEFT JOIN dbo_EA7RECORDS AS dbo_EA7RECORDS_1 ON dbo_EA7FACULTY.EA7RECORDSID = dbo_EA7RECORDS_1.EA7RECORDSID)

INNER JOIN dbo_EA7TERMS ON dbo_EA7CLASSTERMS.EA7TERMSID = dbo_EA7TERMS.EA7TERMSID)

INNER JOIN dbo_TABLEENTRIES AS dbo_TABLEENTRIES_1 ON dbo_EA7TERMS.TERMID = dbo_TABLEENTRIES_1.TABLEENTRIESID)

INNER JOIN dbo_EA7CYCLEDAYS ON dbo_EA7CLASSTERMMEETINGS.EA7CYCLEDAYSID = dbo_EA7CYCLEDAYS.EA7CYCLEDAYSID



WHERE

(((dbo_EA7RECORDS.LASTNAME)="Abernethy") AND ((dbo_EA7ACADEMICYEARS.DESCRIPTION)="Fall 03 thru Summer 04 Upper School")

AND ((dbo_TABLEENTRIES.DESCRIPTION)="Final") AND ((dbo_TABLEENTRIES_1.DESCRIPTION)="Fall") AND ((dbo_EA7CYCLEDAYS.DAY)="D1"));

Disclaimer: We provide programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes you are familiar with Structured Query Language and the tools used to create and modify SQL statements and Crystal Reports. Our Customer Support may help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality.