I want to create a view where an entry in my view is a concatenated string. In this case, it is ParticipantNames.
I have two tables. A Trips table and a Participants table. One trip can have one to many participants. So in my Participant table I have multiple rows that are related to a single entry in the Trip table.
Is it possible to create a string that concatenates the names from all the participants and insert that into the ParticipantNames column? e.g "Hans, Ben, Ali"
CREATE OR ALTER VIEW TripView
AS
SELECT
Id = Trip .Id,
ParticipantNames = ???
FROM
[dbo].Trip Trip
LEFT JOIN
[dbo].[Participants] Participants ON Participants.TripId = Trip.Id