I referred the this LINK but when I try to use the same format I am confused whether I have to use duplicate query or not.Becuase query am having is too lengthy.Please help me on this.
My query gives below result:
is_active, paid, tags_title
1 20 Testing
1 20 Development
1 21 Development
1 21 Testing
1 22 UI
Required result:
is_active, paid, tags_title
1 20 Testing, Development
1 21 Testing, Development
1 22 UI
Update Exact query below:
SELECT DISTINCT proj.is_active, tttm.tags_id,
pal.project_artifact_id
, STUFF((
SELECT ',' + t.tags_title
FROM task_tracker_tags T
WHERE T.tags_id = tttm.tags_id
FOR XML PATH('')
), 1, 1, '') AS tags_title
FROM project_artifact_list pal
LEFT JOIN task_tracker_mapper ttm
ON ttm.artifact_id = pal.Project_Artifact_Id
LEFT JOIN employees emp
ON emp.employee_id = ttm.employee_id
LEFT JOIN task_tracker_tags_mapper tttm
ON tttm.artifact_id = pal.Project_Artifact_id
LEFT JOIN projects proj
ON proj.project_id = tttm.project_id
WHERE pal.Child_Priority IN ('High','Low')
AND pal.artifact_status IN ('Open')
AND emp.employee_id IN (3932,1733)
AND proj.is_active = 1
AND pal.Due_Date <= '01/02/2017'
AND pal.Due_Date >= '01/01/1800'
GROUP BY proj.is_active,Project_Artifact_Id,tttm.tags_id;