Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using wild cards with the IN operator.

Status
Not open for further replies.

dmaranan

Programmer
Aug 14, 2001
46
US
Does anyone know of a way to use wild cards in an IN operator? I know that you can use it with LIKE. But if you are doing a multiple term search in LIKE and you use % signs, the order affects the outcome. Any suggestions?
 
I don't think you can use "IN" in this situation. I would just code a bunch of "LIKE" conditions separated by "OR". For example

select * from my_table
where col1 like '%ABC%'
or col1 like '%DEF%'
or col1 like '%GHI%';
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top