Database Reference
In-Depth Information
Figure 6.57
Use left outer join to select data from two tables.
9. Example 8: Display the last names of the faculty members who advise more than one
student by using the self-join. Enter the following query:
SELECT F.LastName, COUNT(S.StudentID) As [Number of Advisees]
FROM ((FACULTY F JOIN STUDENT S ON F.FacultyID = S.FacultyID)
JOIN STUDENT T ON S.FacultyID = T.FacultyID
AND S.StudentID <> T.StudentID)
GROUP BY F.LastName
Figure 6.58
Use self-join.
Search WWH ::




Custom Search