I have rewritten this question to be more straightforward. I have a SQL query:
SELECT CAST(CASE WHEN DTH.DoubleBookedFlag = 1 THEN DTH.ActivityDate END AS VARCHAR(MAX)) AS DoubleBookedHours
FROM DailyTaskHours DTH
WHERE DTH.DoubleBookedFlag = 1
Here is the result:
Instead of returning as multiple rows, I would like whatever is returned to be one long concatenated string in a single VARCHAR field seperate by a character like |.
How can I achieve this?