I have been butting my head against this problem for the past 4 hours, and I have to tap out. I know I can't be too far from correct I am just not sure what the missing ingredients are.
Here is the problem question:
Student status: List of all students and their enrollment status
Fields: student last name and first name (comma separated), years enrolled, academic advisor last name and first name (comma separated) Sort: years enrolled Input: none Filter: only include currently active students and My code:
SELECT student_id,std_l_name, std_f_name, faculty_l_name, faculty_f_name,student_id_fk,enroll_date,MONTHS_BETWEEN(CURRENT_DATE ,enroll_date)
V1:
FROM STUDENT, FACULTY,ENROLLMENT
WHERE FACULTY.faculty_id=STUDENT.faculty_id_fk3
AND
STUDENT.student_id=ENROLLMENT.student_id_fk
AND ENROLLMENT.enroll_status='active'
ORDER BY ENROLLMENT.enroll_date;
V2:
SELECT student_id,std_l_name, std_f_name, faculty_l_name, faculty_f_name,student_id_fk,enroll_date,MONTHS_BETWEEN(CURRENT_DATE ,enroll_date)
FROM STUDENT, FACULTY,ENROLLMENT
LEFT OUTER JOIN FACULTY
ON STUDENT.student_id=FACULTY.faculty_id
WHERE
STUDENT.student_id=ENROLLMENT.student_id_fk
AND ENROLLMENT.enroll_status='active'
ORDER BY ENROLLMENT.enroll_date;