title: Multiple rows to one comma-separated value in sql
body: <p>We want to display multiple column value into the single column with comma separated value
  below is the my table data </p>
  
  <p><a href="https://i.stack.imgur.com/Dfjlf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Dfjlf.png" alt="enter image description here"></a></p>
  
  <p>Below is the SQL query i am trying:</p>
  
  <pre><code>    select 
           name,
           STUFF((SELECT '; ' + facilty FROM leads Name FOR XML PATH('')),1,2,'') 
   as facilty,
           address
      from leads
  </code></pre>
  
  <p>Query Result</p>
  
  <p><a href="https://i.stack.imgur.com/0iTrQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0iTrQ.png" alt="enter image description here"></a></p>
  
  <p>Now when I execute the query in SQL Server, I want reuslt to be like:</p>
  
  <p><a href="https://i.stack.imgur.com/35Tn0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/35Tn0.png" alt="enter image description here"></a></p>