title: How to select multiple rows as single row
body: <p>In <code>sql server</code>, if I have a table like this :</p>
  
  <pre><code>id   |    name
  -------------
  1    |     x
  2    |     y
  3    |     z
  </code></pre>
  
  <p>I want to create a stored procedure to return the result in one row
  like this :</p>
  
  <pre><code>x | y | z
  </code></pre>
  
  <p>my code is :</p>
  
  <pre><code>alter PROCEDURE getSupervisorEvaluationPercentages
  (
      @FirstSupervisorNumber nvarchar(6),
      @Year int
  )
  as
  DECLARE @Count INT
  DECLARE @OptionID INT
  DECLARE @getOptionID CURSOR
  
  declare @OptionCountTb table(c int)
  
  
  SET @getOptionID = CURSOR FOR
      SELECT Id FROM ObjectiveOption
  OPEN @getOptionID
  FETCH NEXT
      FROM @getOptionID INTO @OptionID
      WHILE @@FETCH_STATUS = 0
      BEGIN
          select @Count = (select COUNT(Id) from EvaluationProcess 
              where FirstSupervisorNumber = @FirstSupervisorNumber and Year = @Year and FirstSupervisorEvaluation = @OptionID)
          insert into @OptionCountTb values(@Count)
          FETCH NEXT
          FROM @getOptionID INTO @OptionID
      END
  CLOSE @getOptionID
  DEALLOCATE @getOptionID
  </code></pre>
  
  <p>I want to display the values of the table <code>@OptionCountTb</code> as single row</p>