34,590
社区成员
发帖
与我相关
我的任务
分享
create table t1(c varchar(10))
create table t2(c varchar(10))
insert into t1(c)
select 'aa' union all
select 'bb' union all
select 'cc' union all
select 'ddd'
insert into t2(c)
select 'waa' union all
select 'aaxx' union all
select 'ccf' union all
select '1bb' union all
select 'ddd' union all
select 'dd' union all
select 'ee'
select t2.*
from t2
inner join t1 on t2.c like '%'+t1.c+'%'
/*
c
----------
waa
aaxx
1bb
ccf
ddd
(5 row(s) affected)
*/
select t2.*
from t2
inner join t1 on t2.c like '%'+t1.c+'%'