Reputation: 31
I want to display from the employees table, only rows where the last_name contains the letters a, o, or e. I wrote the query below but it doesn't work.
select last_name from Hr.employees where last_name like '%a,o,e';
Upvotes: 2
Views: 1761
Reputation: 191
As you are not closing your list with a percentage sign, your list will search only for names ending with the named letters.
Try this instead:
SELECT last_name
FROM Hr.employees
WHERE last_name LIKE '%a%'
OR last_name LIKE '%o%'
OR last_name LIKE '%e%'
Read more on usage of LIKE operator here.
Upvotes: 3
Reputation: 763
Try:
select last_name from Hr.employees
where last_name like '%a%' or last_name like '%e%' or last_name like '%o%';
Upvotes: 2