Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query with inner join question

Status
Not open for further replies.

beckyr51

Programmer
Jan 29, 2008
36
IE
I have a query that returns if someone has free space (determined by taking the number of students they have from their chamber size) this works fine if those people have students, but if they dont have students they dont show. How do i incorporate that if they have no students their chamber size is shown? Here's my sql syntax:

SELECT tblTutor.TU_CODE, tblTutor.TU_TITLE, tblTutor.TU_FORENAME, tblTutor.TU_SURNAME, [TU_CHAMBER_SIZE]-Count([STU_TU_CODE]) AS Free
FROM (tblFaculty INNER JOIN tblTutor ON tblFaculty.FAC_NO=tblTutor.TU_FAC_NO) INNER JOIN tblStudents ON tblTutor.TU_CODE=tblStudents.STU_TU_CODE
GROUP BY tblTutor.TU_CODE, tblTutor.TU_TITLE, tblTutor.TU_FORENAME, tblTutor.TU_SURNAME, tblTutor.TU_CHAMBER_SIZE, tblTutor.TU_FAC_NO, tblFaculty.FAC_NO, tblFaculty.FAC_NAME, tblStudents.STU_TU_CODE
HAVING ((([TU_CHAMBER_SIZE]-Count([STU_TU_CODE]))>0) AND ((tblFaculty.FAC_NAME) Like "*" & [Please enter the Faculty name] & "*"));
 
Could
Code:
([TU_CHAMBER_SIZE]-Count([STU_TU_CODE]))>0)
be causing the problem?
djj
 
Replace this:
INNER JOIN tblStudents
with this:
LEFT JOIN tblStudents

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top