title: SQL Query for retrieving data by combining two queries
body: <p>I am writing two queries in my sql procedure to retrieve data based on the parameter provided from the user in my asp.net application.</p>
  
  <pre><code>IF @Action = 'ID'
    SELECT Name,FirstName,LastName,Employee_ID,Location FROM Salary WHERE  Employee_ID=@Employee_ID
  ELSE IF @Action = 'LASTNAME'
    SELECT Name,FirstName,LastName,Employee_ID,Location FROM Salary WHERE LastName  like '%' + @LastName + '%'
  </code></pre>
  
  <p>Now what I want is to combine the query into single query so that irrespective of whether ID is passed as parameter or lastname is passed i must be able to get the data.</p>
  
  <p>Any help would be greatly appreciated.
  Thanks in Advance. </p>