Home » SQL & PL/SQL » SQL & PL/SQL » nested outer joins
nested outer joins [message #1571] Tue, 14 May 2002 00:25 Go to next message
xycodex
Messages: 1
Registered: May 2002
Junior Member
Okay, here's a problem.
Say I have a student table with the student's id as the key, and the subject codes of the four subjects he is taking, 5 fields in all.
In the subject table, I have the subject code as a key and the subject name.

SO: how do I query the database such that i can get the student's id and the name of the 4 subjects in each row??

I can do that using table aliases and nested outer joins in MS access, but how do you do it in oracle??

is it possible to nest outer joins in oracle??
i'm using oracle 73 here
Re: nested outer joins [message #1589 is a reply to message #1571] Wed, 15 May 2002 06:15 Go to previous message
John R
Messages: 156
Registered: March 2000
Senior Member
If I read your question correctly, the answer would look something like:

SELECT st student_id, s1.subject_name, s2.subject_name, s3.subject_name, s4.subject_name
FROM student st,subject s1,subject s2,subject s3, subject s4
WHERE st.subject_code = s1.subject_code(+)
AND st.subject_code = s2.subject_code(+)
AND st.subject_code = s3.subject_code(+)
AND st.subject_code = s4.subject_code(+);

IF this isn't what you were looking for, just say so.
Previous Topic: Sequence reseted automatically ?
Next Topic: PL/SQL table as IN parameter to stored proc
Goto Forum:
  


Current Time: Tue Apr 23 12:07:37 CDT 2024