Actually I am using SQL Server 2005 and googling this topic I found no easy way to replace the GROUP_CONCAT() function. Most of the results are saying you have to create your own UDF for this except for one result using the 'for xml path('')' or something but I dont know how to incorporate this in the SQL statement
Thanks for the reply but I think I would like all the email addresses like the resultset set shown, ie all email addresses with other columns so that I don't have to create another query. A single query grouping eveything would be nice if that can be done. So it seems that this UDF would do the job. Will try it and post back. I guess the email addresses would be passed to the UDF as a parameter and the resultset returned like in the article mentioned above. Correct?
, MY_FUNCTION(Email.address) AS email_addresses
ON Academics.studentID = Student.studentID
AND Academics.academicYear = 2
ON Courses.courseID = Academics.courseID
ON Email.studentID = Student.studentID
ON Phone.studentID = Student.studentID
WHERE Student.surname = 'James'