34,838
社区成员




declare @name varchar(100)
set @name = 'd'
select top 1 *
from table
where charindex(','+@name+',',','+agroup+','+bgroup+','+cgroup + ',') > 0
order by id
declare @name varchar(100)
set @name = 'd'
select top 1 *
from table
where charindex(',+@name+,',','+agroup+','+bgroup+','+cgroup + ',') > 0
order by id
select top 1 *
from table
where charindex(',d,',','+agroup+','+bgroup+','+cgroup + ',') > 0
order by id
--其中一个包含.
select top 1 * from tb where charindex(','+@session+',' , ','+agroup+',') > 0 or
charindex(','+@session+',' , ','+bgroup+',') > 0 or
charindex(','+@session+',' , ','+cgroup+',') > 0
--三个都包含
select top 1 * from tb where charindex(','+@session+',' , ','+agroup+',') > 0 and
charindex(','+@session+',' , ','+bgroup+',') > 0 and
charindex(','+@session+',' , ','+cgroup+',') > 0
select top 1 *
from table
where charindex(',d,',','+agroup+',') > 0 or charindex(',d,',','+bgroup+',') > 0
or charindex(',d,',','+cgroup+',') > 0
order by id
select top 1 * from tb where charindex(','+@session+',' , ','+agroup+',') > 0 or
charindex(','+@session+',' , ','+bgroup+',') > 0 or
charindex(','+@session+',' , ','+cgroup+',') > 0