0

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;

Edited by mr_4

2
Contributors
2
Replies
14
Views
1 Month
Discussion Span
Last Post by mr_4
0

UP DATE I GOT IT WORKIGN WITH THIS CODE!

SELECT S.student_id AS "STUDENT ID",S.std_l_name AS "STUDENT LAST NAME",S.std_f_name AS "STUDENT FIRST NAME",S.faculty_ID_FK3 AS "FACULTY ID",F.faculty_l_name AS "FACULTY LAST NAME",F.faculty_f_name AS "FACULTY FIRST NAME",(MONTHS_BETWEEN(SYSDATE,E.enroll_date)/12) AS "YEARS ENROLLED"
FROM STUDENT S 
INNER JOIN FACULTY F ON S.faculty_ID_FK3 = F.faculty_id
INNER JOIN ENROLLMENT E ON S.student_id = E.student_id_fk
WHERE E.enroll_status ='ACTIVE'
ORDER BY E.enroll_date DESC;
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.