Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use LIKE and IN for a WHERE statment?

Tags:

sql

I have a list of place names and would like to match them to records in a sql database the problem is the properties have reference numbers after there name. eg. 'Ballymena P-4sdf5g' Is it possible to use IN and LIKE to match records

WHERE dbo.[Places].[Name] IN LIKE('Ballymena%','Banger%')
like image 207
Euclid Avatar asked Dec 02 '10 13:12

Euclid


1 Answers

No, but you can use OR instead:

WHERE (dbo.[Places].[Name] LIKE 'Ballymena%' OR
       dbo.[Places].[Name] LIKE 'Banger%')
like image 149
Mark Byers Avatar answered Oct 02 '22 13:10

Mark Byers