日期:2014-05-16  浏览次数:20733 次

各位同行前辈,帮忙看一下这个sql怎么处理。
table1
-------------
字段名
user_Arr id

12,34,56,66 1
34,56 2
------------------------------
table2
------------
字段名
user_Id

12
34
56

select user_id from table2 where user_id in (select user_arr from table1 where id =1)
希望达到这种效果,该处理table1的字段值?
select user_id from table2 where user_id in ('12,34,56,66')
-----------
我的一个字段的值是12,34,56,66 
我需要查另一个表,希望能in这张表的字段。 
但是因为是字段不是字符串,所以in不出来。 


------解决方案--------------------
探讨
SQL code


select a.user_id
from table2 a,
table1 b
where instr(b.user_arr, a.user_id) > 0;