View Full Version : Combining fields from multiple tables


PoortH
10-17-2001, 09:37 AM
Hallo,

I have a table with the fields course codes and course names and another table
with the fields course codes and course teachers. How do i create a query with all the course teachers related to a course code in 'one' teachers field?

Course table:
CourseCode/CourseName
192202/My course

Teacher table:
CourseCode/CourseTeacher
192202/Mr. A
192202/Mr. B
192202/Mr. C

Desired query output:
CourseCode/CourseName/CourseTeachers
195202/My course/Mr. A, Mr B, Mr C

Thanx in advance for any responses!

Regards
Harmannus, The Netherlands

pdx_man
10-17-2001, 01:05 PM
SELECT t1.coursecode, t1.coursename, t2.courseteachers
FROM Table1 t1
INNER JOIN Table2 t2 on t1.coursecode = t2.coursecode

You will have to change the names of the tables accordingly.

When your done changing the names, paste this into the SQL view of your query.