-1

How do you write a query with "multiple string/substring matching"?

Example:

SELECT * FROM table WHERE column LIKE ('%BD%','%IND%','%PK%','%USA%')
ಠ_ಠ
  • 3,060
  • 28
  • 43
  • 1
    Do you want to match any of the strings, or any combination of these strings in the columns? Also, what DBMS are you using - MySQL or Oracle? – shree.pat18 Dec 11 '14 at 07:41
  • Possible duplicate of mysql - http://stackoverflow.com/questions/4172195/mysql-like-multiple-values and oracle - http://stackoverflow.com/questions/1387612/how-can-i-introduce-multiple-conditions-in-like-operator – Wundwin Born Dec 11 '14 at 07:42

2 Answers2

2

Try this:

select * from table where column like '%BD%' or column like '%IND%'or column like'%PK%' or column like'%USA%'
Jens
  • 67,715
  • 15
  • 98
  • 113
0
select * from table 
 where regexp_like(column,'BD|IND|PK')
Rusty
  • 1,988
  • 10
  • 12