CREATE TABLE t1
(
id varchar(10),
age varchar(2)
)
insert into t1 values('1,2,3','FF')
insert into t1 values('4','GG')
create table t2
(
id varchar(5),
name char(2)
)
insert into t2
select
1, 'aa' union
select
2, 'bb' union
select
3, 'cc' union
select
4, 'dd'
select b.id,b.name,a.age from t1 a,t2 b
where charindex(','+b.id+',',','+a.id+',')>0
/*
id name age
----- ---- ----
1 aa FF
2 bb FF
3 cc FF
4 dd GG
(4 行受影响)
*/