SELECT * FROM Customers
WHERE CustomerName LIKE ('%aa%','%bb%','%cc%');
Asked
Active
Viewed 258 times
1
Ullas
- 11,450
- 4
- 33
- 50
HemalHerath
- 1,006
- 2
- 18
- 38
-
Try this- [Introduce-multiple-conditions-in-like-operator](http://stackoverflow.com/questions/1387612/how-can-i-introduce-multiple-conditions-in-like-operator) – Chirag Jain Apr 27 '17 at 04:20
4 Answers
2
Try splitting your conditions like this
WHERE CustomerName LIKE '%aa%' OR CustomerName LIKE '%bb%' OR CustomerName LIKE '%cc%'
Ikyong
- 123
- 7
1
Try
SELECT * FROM Customers
WHERE CustomerName LIKE '%aa%' OR CustomerName LIKE '%bb%' OR CustomerName LIKE '%cc%';
LIKE does not work the same as IN where you can list a set of possibilities to match against. You have to use an OR between LIKE statements to match multiple patterns.
Ullas
- 11,450
- 4
- 33
- 50
Lance Whatley
- 2,395
- 1
- 13
- 16
0
SELECT * FROM Customers WHERE CustomerName LIKE '%aa%' OR CustomerName LIKE '%bb%' OR CustomerName LIKE '%cc%'
Vivek Kumar Singh
- 3,223
- 1
- 14
- 27
0
You can also use the following code
SELECT * FROM Customers
WHERE
instr(CustomerName,'aa')>0 or instr(CustomerName,'bb')>0 or instr(CustomerName,'cc')>0
However this is working in oracle 11G, Please check the compatibility as well
Akanksha
- 91
- 7