title: How to return multiple varchar from a stored procedure where condition is met
body: <p>Hi I have created a Table in which I am storing first name, last name and email ID of some persons. </p>
  
  <p>The table is as follows:</p>
  
  <pre><code>create table frnds
  (
  id int Primary Key,
  firstName varchar (20) not null,
  lastName varchar (20) not null,
  emailID varchar (30)not null
  )
  </code></pre>
  
  <p>I have to write a Stored Procedure to return the "first name" values from the table wherever there is a match with the input "last name" value. 
  I have some of the names with common last names. So I want to have all the first names as the output of the Stored Procedure.</p>
  
  <p>I am using the following code to do that but have been able to get only one matching first name as output.</p>
  
  <pre><code>Create Procedure GetFirstName
  (
  @lastName varchar(20),
  @firstName varchar(20) OUT
  )
  AS 
  Begin
  Select @firstName = firstName from frnds where lastName = @lastName
  End
  </code></pre>
  
  <p>Also this is how I am displaying the result:</p>
  
  <pre><code>declare @LastName varchar (20)
  Exec GetFirstName Daniels, @LastName output 
  select @LastName
  </code></pre>
  
  <p>I know that this is because I have the output parameter such that it can hold only one matching first name. Since I am new to SQL, I am not able to figure out how to achieve this. Please help with any suggestion or some link which can guide me in the right direction.
  Thanks!!!</p>