表A 字段b nvarchar (256)字段B里会存放一组编号 s0001,s0002,s0003,s0004(这从s0001,到s0004都是一条记录这个字段内容,)表D
字段c nvarchar(12)
c里会存放一个编码 s0002现在要把表D中c字段存在于B字段的记录都找出来,咋整?不知道说清楚没有select * from D where c …………不会写了
字段c nvarchar(12)
c里会存放一个编码 s0002现在要把表D中c字段存在于B字段的记录都找出来,咋整?不知道说清楚没有select * from D where c …………不会写了
if object_id('a') is not null drop table a
go
create table a(b varchar(200))
insert into a
select 's0001,s0002,s0003,s0004' union all
select 's0001,s0005,s0002' union all
select 's0001,s0005'if object_id('d') is not null drop table d
go
create table d(c varchar(50))
insert into d
select 's0002'--查询
select m.b from a as m , d as t where charindex(t.c,m.b)>0