SQL - search multiple strings

Hi Experts

I'm having some difficulty adding strings to an existing, functioning query.  It should read  where PP_Problem contains string1 or string 2 but i get syntax errors whichever way i try this.

PS using the word OR instead of a comma returns all the records without filtering any of the strings

Many thanks


this works 
SQL = SQL & " where [PP_Problem] like '*String1*' "
this one doesn't 
SQL = SQL & " where [PP_Problem] like '*String1*' , '*String2*'"

Open in new window

Who is Participating?
msfletchConnect With a Mentor Commented:
Try this:

SQL = SQL & " where [PP_Problem] like '*String1*' OR [PP_Problem] like '*String2*'"
jml948Connect With a Mentor Commented:
I believe the correct way to do this would be the following:

SQL = SQL & " where [PP_Problem] like '*String1*' or [PP_Problem] like '*String2*'"
peterdarazsAuthor Commented:
Thanks experts

Sorry about the points split - there were 2 identical responses and I now wish i assigned more to go around. many thanks
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.