table1:
id  typeid  info
1     1      asdasdfsf
2     1      asdfasdff
3     2      asasdfsdf
4     3      aasdffasdf
5     4      aasdfsdf
6     4      asdasdff
7     5      asdfasdf
table2
id    typeinfo
1      1,2,3
2      1,3,4
3      1,4,5
4      1,2,3
5      1,2,3
根据table2的typeinfo查找出在table1 中的记录集Select * from table1 where id in (select typeinfofrom table2 where id=1)请高手解答

解决方案 »

  1.   

    Select * from table1 where id in (select typeinfo from table2 where id=1)
      

  2.   

    应该是Select * from table1 where typeid in (select typeinfo from table2 where id=1),求高手指教
      

  3.   

    这样应该可以:
    Select * from table1 where typeid like '%' || (select typeinfo from table2 where id=1) || '%'
      

  4.   

    sql的话,不知道,plsql的话可以使用动态sql
      

  5.   

    你的table1表中的 typeid是什么用。???
      

  6.   

    不知道楼主想要什么.
    我理解是table2 tableinfo中,包含table1 tableid中的内容就显示,是这样的吗?
    select distinct a.id,a.typeid,a.info
    from a_1 a,a_2 b
    where instr(b.typeinfo,a.typeid) > 0
      

  7.   

    select * from t1
    where exists(
      select * from t2
      where instr(','||t2.typeinfo||',', ','||t1.typeid||',')>0
    )
      

  8.   

    select * from t1
    where t1.typeid in ( 
      select c.c from t2, table(f_sep(t2.typeinfo, ',') c
    )
      

  9.   

    select * from t1
    where t1.typeid in ( 
      select c.c from t2, table(f_sep(t2.typeinfo, ',')) c
    )
      

  10.   

    我说怎么没有见过那   还以为是ORACLE带的那??