title: How to make row data comma separated in SQL Server
body: <p>How to make row data comma-separated in SQL Server?</p>
  
  <pre><code>CREATE TABLE CountryState
  (Country Varchar(15), State Varchar(15))
  GO
  
  INSERT INTO CountryState VALUES('India','MH')
  INSERT INTO CountryState VALUES('India','DL')
  INSERT INTO CountryState VALUES('US','NJ')
  INSERT INTO CountryState VALUES('US','NY')
  GO
  
  SELECT * FROM CountryState
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>Country State
  ----------------------------    
  India   MH
  India   DL
  US  NJ
  US  NY
  </code></pre>
  
  <p>I require output in following format.</p>
  
  <pre><code>Country State
  ------------------    
  India   MH,DL
  US          NJ,NY   
  </code></pre>