title: Comma Separated SQL Server Result Set 'JOINED' with other Columns
body: <p>I have a table say <code>ProjectMaster</code>:</p>
  
  <pre><code>  Id       ProjectName
    1         A
    2         B
    3         C
  </code></pre>
  
  <p>another table <code>ProjectMeter</code></p>
  
  <pre><code> Id   ProjectId   MeterNumber
   1      1          #0001
   2      1          #0002
   3      1          #0003 
   4      2          #0004
   5      2          #0005 
   6      3          #0006
  </code></pre>
  
  <p>I wish to have following output</p>
  
  <pre><code>ProjectName   MeterNumbers 
   A             #0001, #0002, #0003
   B             #0004, #0005
   C             #0006
  </code></pre>
  
  <p>I tried <a href="https://stackoverflow.com/questions/4819412/convert-sql-server-result-set-into-string">this</a> and <a href="https://stackoverflow.com/questions/8302337/sql-server-sub-query-with-a-comma-separated-resultset">this</a>, but unable to solve my problem.
  I cannot use a table variable. </p>
  
  <p>I have a already written Stored Procedure and it brings data from many <code>joined</code> tables. ProjectMaster also happens to be joined in one of these tables. Now am required to fetch data from ProjectMeter, such that, each row has concatenated ProjectMeter.MeterNumber corresponding to the ProjectId in that column.</p>
  
  <p>right now, I get concatenated list of all meternumbers in all the rows. </p>
  
  <pre><code>I cannot use CURSOR, TABLE variable , Temp TABLE 
  </code></pre>
  
  <p>( I hope still something can be done to my cause)</p>
  
  <p>please help.....</p>