I have a query that produces a table of courses for which a student is registered, but in order to export it for email merge as a csv file it needs to be in a different order. Now each course for which a student is registered gets a different row, using the following SQL:
However, for the csv file I need a table with a single row for each student listing the courses for which that student is enrolled.
Code:
SELECT StudentEnrollment.EnrollmentID, StudentEnrollment.StudentName, StudentEnrollment.CourseID, StudentEnrollment.Priority, StudentEnrollment.StudentID, CourseData.CourseName, MemberData.[E-MAIL]
FROM MemberData INNER JOIN (CourseData INNER JOIN StudentEnrollment ON CourseData.CourseID = StudentEnrollment.CourseID) ON MemberData.StudentID = StudentEnrollment.StudentID;
However, for the csv file I need a table with a single row for each student listing the courses for which that student is enrolled.