Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> SQL for spreadsheet output
I have a Oracle 9i database with two tables eg.:
TblStudent { StudentId(PK), StudentName, StudentSurname, StudentTel } TblCourse { CourseId(PK), StudentId(FK), CourseName, CourseDate, Result }
The relationship between TblStudent and TblCourse is a 1:M relationship, that is, one student can do many courses.
I'm using an .asp page to generate an excel spreadsheet of students and the courses they have completed. I want the spreasheet to be laid out as follows:
StudentId | StudentName | StudentSurname | StudentTel | CourseId | CourseName | CourseDate | Result
If the student has taken more than one course it will look like this:
For two courses:
StudentId | StudentName | StudentSurname | StudentTel | CourseId |
CourseName | CourseDate | Result | CourseId | CourseName | CourseDate
| Result
For three courses:
StudentId | StudentName | StudentSurname | StudentTel | CourseId |
CourseName | CourseDate | Result | CourseId | CourseName | CourseDate
| Result | CourseId | CourseName | CourseDate | Result
How do I structure my sql statement so that I get this result? Received on Fri Jul 23 2004 - 09:42:45 CDT