If I have a table called Activities:
..and another table called Tutors:
If I were to do a simple LEFT JOIN
for the tutor names on their LearnerId / InstanceId records in the activities table I would get a result like this:
(Sql for the above result):
SELECT Activities.LearnerId, Activities.InstanceId,
Activities.LastName, Activities.FirstName, Activities.Activity,
Tutors.TutorLastName, Tutors.TutorFirstName
FROM Activities
LEFT JOIN Tutors ON (Activities.InstanceId = Tutors.InstanceId)
AND (Activities.LearnerId = Tutors.LearnerId);
I would prefer that the number of records in the Activities table is maintained (i.e. the query results in 4 records rather 7).
I would also like every tutor matched to a LearnerId / InstanceId record to be collected in another column called Tutors(s), where the names of the related tutors are all listed in one field with commas separating each tutor. In other words, a results that looks like this:
...is it possible to do this just in SQL, or can this only be achieved in VBA?