redtape2015
redtape2015

Reputation: 85

OR operation between columns in SELECT query in Oracle

I wonder if it is possible to use OR operation between columns in a SELECT query?

select 
  first_name, 
  last_name 
from 
  employee 
where 
  (first_name OR last_name)='&enter_search_string';

Upvotes: 0

Views: 90

Answers (2)

Rahul Tripathi
Rahul Tripathi

Reputation: 172568

You neeed to use it like this:

select 
  first_name, 
  last_name 
from 
  employee 
where first_name='first_name' OR last_name='last_name';

Upvotes: 2

programmer43229
programmer43229

Reputation: 386

Just my preference:

SELECT first_name,  last_name 
FROM employee 
WHERE '&enter_search_string' IN (first_name, last_name)

Upvotes: 4

Related Questions