select * from table1 where id in (select id1s from table2 where id2=1)
id1是int类型的,id1s是varchar类型的
------解决方案--------------------
- SQL code
declare @str varchar(100)select @str = id1s from table2 where id2=1select * from table1 where charindex(','+ltrim(id)+',',',[email protected]+',') > 0