title: Sql combine 2 rows to one
body: <p>i have this table Testers </p>
  
  <pre><code>employee name
  ------------
  Sam Korch
  dan mano
  </code></pre>
  
  <p>i want to combine tow rows to one, it will be "Sam Korch,Dan Mano"</p>
  
  <p>i have this query</p>
  
  <pre><code>select @theString = COALESCE(@theString + ',', '') + EmployeeName 
    from Testers join vw_EKDIR on Testers.TesterGlobalId = vw_EKDIR.GlobalID
   where TestId = 31   
  </code></pre>
  
  <p>it working but i dont want to do select i want the result will be in @thestring </p>
  
  <p>so i try to do this query  </p>
  
  <pre><code>set @theString = (
      select  @theString = COALESCE(@theString + ',', '') + EmployeeName 
        from Testers join vw_EKDIR on Testers.TesterGlobalId = vw_EKDIR.GlobalID
       where TestId = 31 
      )
  </code></pre>
  
  <p>it is not working ... i want @thestring will be the result.</p>
  
  <p>any idaes ?</p>
  
  <p>thanks </p>