select cc_name from t_customer_company
where cc_id in (
SELECT  c.cc_friend_ids
FROM t_project a, t_customer_company b, t_project_quotedprice c
WHERE a.p_id = c.p_id 
and b.cc_id = c.cc_id 
and a.user_id = 1;
)cc_friend_ids在数据库中是varchar类型的。数据像这样2,4,5
如子查询 SELECT  c.cc_friend_ids
FROM t_project a, t_customer_company b, t_project_quotedprice c
WHERE a.p_id = c.p_id 
and b.cc_id = c.cc_id 
and a.user_id = 1;
的结果为2,3,4是个字符串
然后主查询本应该是这样的
select cc_name from t_customer_company
where cc_id in (
    2,3,4
)但是每次都成了这样
select cc_name from t_customer_company
where cc_id in (
    2
)
只会认到第一个id。求指点。