Avatar of vb7guy
vb7guy
Flag for United States of America asked on

Select SQL Query Multiple phrases using "like" parameter

Can I combine two SQL phrase in a single where clause. Here is an example. it hasn't worked for me and I couldn't find any in the help file.  I may have more then two publicationID that I'm trying to pull, but I don't know the full name.

I want to able to use "like" and "in" in the same statement.

select PublicationID,publicationname  from dbo.tblPublication where publicationname in (like '%Asia Pac%',like '%Global Watch%')
Microsoft SQL ServerMicrosoft SQL Server 2005SQL

Avatar of undefined
Last Comment
vb7guy

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Guy Hengel [angelIII / a3]

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Aneesh

select PublicationID,publicationname  from dbo.tblPublication where publicationname in (

SELECT publicationname  FROM  dbo.tblPublication where publicationname   like '%Asia Pac%',like '%Global Watch%')
SOLUTION
ee_rlee

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Aneesh

oops dont care about mine, i accidently press the subit button :)
vb7guy

ASKER
Aaah, Thanks.  "OR" is what I thought. But I wish if it was easy to just use "IN" statement and "LIke" phrase.   Thanks
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck