Solved

SQL - search multiple strings

Posted on 2008-06-11
3
1,086 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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Requesting help with creating an SQL query with 2 tables 6 37
SQL - Curser to do an insert based on a select 2 28
Oracle Date 6 33
Need multiple Group By's 8 50
In database programming, custom sort order seems to be necessary quite often, at least in my experience and time here at EE. Within the realm of custom sorting is the sorting of numbers and text independently (i.e., treating the numbers as number…
As they say in love and is true in SQL: you can sum some Data some of the time, but you can't always aggregate all Data all the time! Introduction: By the end of this Article it is my intention to bring the meaning and value of the above quote to…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…
Suggested Courses

742 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