--测试环境 declare @t table(ID int ,Type varchar(50)) insert into @t select 1,'$1$,$2$' union all select 2,'$3$' union all select 3,'$4$,$5$' union all select 4,'$3$' union all select 5,'$2$'select * from @t where type like '%$1$%' or type like '%$2$%' or type like '%$3$%' ---------------------------------- /* ID type 1 $1$,$2$ 2 $3$ 4 $3$ 5 $2$ */
declare @t table(ID int ,Type varchar(50))
insert into @t
select 1,'$1$,$2$' union all
select 2,'$3$' union all
select 3,'$4$,$5$' union all
select 4,'$3$' union all
select 5,'$2$'select * from @t where
type like '%$1$%' or
type like '%$2$%' or
type like '%$3$%'
----------------------------------
/*
ID type
1 $1$,$2$
2 $3$
4 $3$
5 $2$
*/