title: Group By and STUFF combined result in sql server
body: <p>I referred the <a href="https://stackoverflow.com/questions/31211506/how-stuff-and-for-xml-path-work-in-sql-server">this LINK</a> 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.</p>
  
  <p>My query gives below result:</p>
  
  <pre><code>is_active,    paid,  tags_title 
  1             20    Testing
  1             20    Development
  1             21    Development
  1             21    Testing
  1             22    UI
  </code></pre>
  
  <p>Required result:</p>
  
  <pre><code>is_active,    paid,  tags_title 
  1             20    Testing, Development
  1             21    Testing, Development
  1             22    UI
  </code></pre>
  
  <p><strong>Update Exact query below:</strong></p>
  
  <pre><code>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 &lt;= '01/02/2017' 
  AND pal.Due_Date &gt;= '01/01/1800' 
  GROUP BY proj.is_active,Project_Artifact_Id,tttm.tags_id;
  </code></pre>