We help IT Professionals succeed at work.
Get Started

Modify SQL to use OUTER JOIN

459 Views
Last Modified: 2012-05-11
Using CF to connect to Access 2007 DB, but this is more of a SQL question.

I have a table courseloads (facultyID, sectionID, clID) which keeps track of who's teaching what section. so if a professor is teaching a section their facultyID and the sectionID are put in the table

I want to run a query to produce all the sections offered including those without assigned professors.  

I need to modify the attached SQL to show ALL sections including those not listed in the table 'courseloads'.  As of now it only shows records that appear in courseloads and sections.  I believe I need an outer join but don't know how to implement.
SELECT Courses.CourseTitle, Sections.SemCode, Courses.CourseID, Sections.SectionNumber, Sems.SemDetails, Faculty.LastName, Faculty.FirstName, Courses.ID, Sections.SectionID
FROM (Sems INNER JOIN (Courses INNER JOIN Sections ON Courses.[ID] = Sections.[CourseID]) ON Sems.[SemCode] = Sections.[SemCode]) INNER JOIN (Faculty INNER JOIN CourseLoads ON Faculty.[schoolID] = CourseLoads.[FacultyID]) ON Sections.[SectionID] = CourseLoads.[SectionID]
ORDER BY courses.courseID, sems.semcode, sections.sectionnumber;

Open in new window

Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE