SQL Server using wildcard within IN
Solution 1:
How about:
WHERE LEFT(job_no, 4) IN ('0711', '0712', ...)
Solution 2:
I think I have a solution to what the originator of this inquiry wanted in simple form. It works for me and actually it is the reason I came on here to begin with. I believe just using parentheses around the column like '%text%' in combination with OR
s will do it.
select * from tableName
where (sameColumnName like '%findThis%' or sameColumnName like '%andThis%' or
sameColumnName like '%thisToo%' or sameColumnName like '%andOneMore%')
Solution 3:
How about something like this?
declare @search table
(
searchString varchar(10)
)
-- add whatever criteria you want...
insert into @search select '0711%' union select '0712%'
select j.*
from jobdetails j
join @search s on j.job_no like s.searchString
Solution 4:
You could try something like this:
select *
from jobdetails
where job_no like '071[12]%'
Not exactly what you're asking, but it has the same effect, and is flexible in other ways too :)