SQL模糊查询,该怎么解决

SQL模糊查询
SQL模糊查询,该怎么解决

数据库里面 我这样查询为什么查询不到?
------解决思路----------------------
那可能需要先把表中的数据进行行转列,然后再匹配,不如先这样:
if OBJECT_ID('test') is not null
drop table test 
go 
create table test 

    id int, 
    name varchar(10), 
    [key] varchar(20) 

go 
insert test 
select 1,'lisa','li,is,sa' union all
select 2,'sophia','ab,cd,ef' union all
select 3,'lori','12,34,23'
go 
  
select
    id, 
    a.name, 
    SUBSTRING([key],number,CHARINDEX(',',[key]+',',number)-number) as [key] 
from
    test a,master..spt_values 
where
    number >=1 and number<=len([key])  
    and type='p' 
    and substring(','+[key],number,1)=','
/* 
id    name    key
----------------------------- 
1    lisa    li 
1    lisa    is
1    lisa    sa 
2    sophia    ab 
2    sophia    cd 
2    sophia    ef 
3    lori    12 
3    lori    34 
3    lori    23 
*/