Solved

SQL - search multiple strings

Posted on 2008-06-11
3
1,087 Views
Last Modified: 2012-06-21
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

Peter


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

0
Comment
Question by:peterdarazs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
msfletch earned 65 total points
ID: 21766330
Try this:

SQL = SQL & " where [PP_Problem] like '*String1*' OR [PP_Problem] like '*String2*'"
0
 
LVL 2

Assisted Solution

by:jml948
jml948 earned 60 total points
ID: 21766339
I believe the correct way to do this would be the following:

SQL = SQL & " where [PP_Problem] like '*String1*' or [PP_Problem] like '*String2*'"
0
 

Author Closing Comment

by:peterdarazs
ID: 31466447
Thanks experts

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

Featured Post

Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question